pymte 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pymte-1.0.0/.gitattributes +2 -0
- pymte-1.0.0/.github/workflows/ci.yml +62 -0
- pymte-1.0.0/.github/workflows/oracle.yml +30 -0
- pymte-1.0.0/.github/workflows/release.yml +37 -0
- pymte-1.0.0/.gitignore +13 -0
- pymte-1.0.0/.readthedocs.yaml +17 -0
- pymte-1.0.0/CITATION.cff +53 -0
- pymte-1.0.0/LICENSE +674 -0
- pymte-1.0.0/PKG-INFO +122 -0
- pymte-1.0.0/README.md +74 -0
- pymte-1.0.0/docs/_static/favicon.svg +4 -0
- pymte-1.0.0/docs/_templates/layout.html +4 -0
- pymte-1.0.0/docs/api.md +113 -0
- pymte-1.0.0/docs/citing.md +66 -0
- pymte-1.0.0/docs/conf.py +58 -0
- pymte-1.0.0/docs/datasets.md +40 -0
- pymte-1.0.0/docs/faq.md +37 -0
- pymte-1.0.0/docs/guide/audit.md +68 -0
- pymte-1.0.0/docs/guide/confidence-intervals.md +85 -0
- pymte-1.0.0/docs/guide/index.md +16 -0
- pymte-1.0.0/docs/guide/ivlike.md +80 -0
- pymte-1.0.0/docs/guide/mtr-specification.md +90 -0
- pymte-1.0.0/docs/guide/plotting.md +46 -0
- pymte-1.0.0/docs/guide/propensity.md +45 -0
- pymte-1.0.0/docs/guide/shape-restrictions.md +57 -0
- pymte-1.0.0/docs/guide/specification-tests.md +52 -0
- pymte-1.0.0/docs/guide/splines.md +50 -0
- pymte-1.0.0/docs/guide/target-parameters.md +111 -0
- pymte-1.0.0/docs/index.md +34 -0
- pymte-1.0.0/docs/installation.md +29 -0
- pymte-1.0.0/docs/migration.md +110 -0
- pymte-1.0.0/docs/quickstart.md +86 -0
- pymte-1.0.0/docs/theory.md +125 -0
- pymte-1.0.0/pyproject.toml +104 -0
- pymte-1.0.0/src/pymte/__init__.py +74 -0
- pymte-1.0.0/src/pymte/audit.py +547 -0
- pymte-1.0.0/src/pymte/callcheck.py +50 -0
- pymte-1.0.0/src/pymte/data/PROVENANCE.md +39 -0
- pymte-1.0.0/src/pymte/data/ae.csv.gz +0 -0
- pymte-1.0.0/src/pymte/data/ivmte_sim_data.csv.gz +0 -0
- pymte-1.0.0/src/pymte/datasets.py +55 -0
- pymte-1.0.0/src/pymte/design.py +100 -0
- pymte-1.0.0/src/pymte/ivlike.py +241 -0
- pymte-1.0.0/src/pymte/lp.py +625 -0
- pymte-1.0.0/src/pymte/monobound.py +311 -0
- pymte-1.0.0/src/pymte/mst.py +1649 -0
- pymte-1.0.0/src/pymte/mtr.py +390 -0
- pymte-1.0.0/src/pymte/plots.py +155 -0
- pymte-1.0.0/src/pymte/propensity.py +144 -0
- pymte-1.0.0/src/pymte/py.typed +0 -0
- pymte-1.0.0/src/pymte/splines.py +100 -0
- pymte-1.0.0/src/pymte/sweights.py +73 -0
- pymte-1.0.0/src/pymte/testdata.py +210 -0
- pymte-1.0.0/src/pymte/testfunctions_covariates.py +131 -0
- pymte-1.0.0/src/pymte/testfunctions_splines.py +122 -0
- pymte-1.0.0/src/pymte/wweights.py +178 -0
- pymte-1.0.0/tests/conftest.py +70 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_ate_poly.json +235 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_boolean_terms.json +203 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_linear_u.json +195 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_linear_u_boot50.json +281 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_linear_u_linear_link.json +195 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_linear_u_probit.json +195 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_point_gmm.json +98 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_point_gmm_boot50.json +188 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_poly.json +235 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_poly_uname_v.json +235 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_regression_point.json +25 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_splines.json +337 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_splines_noint_shape.json +178 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_att_splines_shape.json +337 -0
- pymte-1.0.0/tests/fixtures/oracle/ae_atu_poly.json +235 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_basic_dist.csv +13 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_basic_full.csv +1001 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_covariates_dist.csv +37 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_covariates_full.csv +10001 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_mosquito.csv +401 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_splines_dist.csv +7 -0
- pymte-1.0.0/tests/fixtures/oracle/dist_splines_full.csv +4201 -0
- pymte-1.0.0/tests/fixtures/oracle/halton.json +7 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_custom_weights_late_x2.json +212 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_equal_coef_regression_point.json +27 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_genlate.json +212 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_genlate_x2.json +212 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_late.json +212 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_late_boot50.json +298 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_late_boot50_m2000_subsample.json +298 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_late_x2.json +212 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_late_x8.json +212 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_lp_spec_test_boot50.json +234 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_multi_ivlike.json +368 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_multi_ivlike_components.json +263 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_multi_ivlike_subset.json +374 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_point_gmm.json +119 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_point_gmm_eyeweight.json +119 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_point_gmm_many_moments.json +161 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_point_lp_tol0.json +147 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_point_regression_equal_coef.json +24 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_point_regression_ols.json +24 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_shape_ignored_point.json +119 -0
- pymte-1.0.0/tests/fixtures/oracle/sim_spec_test_boot50.json +211 -0
- pymte-1.0.0/tests/fixtures/oracle/splines.json +2202 -0
- pymte-1.0.0/tests/fixtures/oracle/tt_covariates.json +247 -0
- pymte-1.0.0/tests/fixtures/oracle/tt_single.json +166 -0
- pymte-1.0.0/tests/fixtures/oracle/tt_splines.json +262 -0
- pymte-1.0.0/tests/fixtures/oracle/tt_splines_custom_weights.json +262 -0
- pymte-1.0.0/tests/fixtures/run_oracle.R +461 -0
- pymte-1.0.0/tests/test_arguments.py +128 -0
- pymte-1.0.0/tests/test_bootstrap.py +159 -0
- pymte-1.0.0/tests/test_covariates.py +185 -0
- pymte-1.0.0/tests/test_datasets.py +52 -0
- pymte-1.0.0/tests/test_direct_qp.py +111 -0
- pymte-1.0.0/tests/test_moments.py +218 -0
- pymte-1.0.0/tests/test_mtr.py +130 -0
- pymte-1.0.0/tests/test_parity.py +296 -0
- pymte-1.0.0/tests/test_plots.py +55 -0
- pymte-1.0.0/tests/test_propensity.py +61 -0
- pymte-1.0.0/tests/test_single.py +128 -0
- pymte-1.0.0/tests/test_splines.py +224 -0
- pymte-1.0.0/tests/test_uspline.py +41 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- run: pip install ".[dev]"
|
|
17
|
+
- run: ruff check .
|
|
18
|
+
- run: ruff format --check .
|
|
19
|
+
- run: mypy
|
|
20
|
+
|
|
21
|
+
package:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
- run: pip install build twine
|
|
29
|
+
- run: python -m build
|
|
30
|
+
- run: twine check dist/*
|
|
31
|
+
- run: pip install dist/*.whl
|
|
32
|
+
- run: python -c "import pymte; print(pymte.__version__)"
|
|
33
|
+
|
|
34
|
+
test:
|
|
35
|
+
runs-on: ${{ matrix.os }}
|
|
36
|
+
strategy:
|
|
37
|
+
fail-fast: false
|
|
38
|
+
matrix:
|
|
39
|
+
os: [ubuntu-latest]
|
|
40
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
41
|
+
include:
|
|
42
|
+
- os: windows-latest
|
|
43
|
+
python-version: "3.12"
|
|
44
|
+
- os: macos-latest
|
|
45
|
+
python-version: "3.12"
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
- uses: actions/setup-python@v5
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ matrix.python-version }}
|
|
51
|
+
- run: pip install ".[dev,plots]"
|
|
52
|
+
- run: pytest
|
|
53
|
+
|
|
54
|
+
docs:
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v4
|
|
58
|
+
- uses: actions/setup-python@v5
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.12"
|
|
61
|
+
- run: pip install ".[docs]"
|
|
62
|
+
- run: sphinx-build -W --keep-going -b html docs docs/_build/html
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: R oracle
|
|
2
|
+
|
|
3
|
+
# Regenerates the R reference fixtures with the current R package and runs
|
|
4
|
+
# the parity tests against them. Informational: it never blocks a push.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
oracle:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
continue-on-error: true
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: r-lib/actions/setup-r@v2
|
|
16
|
+
with:
|
|
17
|
+
r-version: "release"
|
|
18
|
+
- uses: r-lib/actions/setup-r-dependencies@v2
|
|
19
|
+
with:
|
|
20
|
+
packages: |
|
|
21
|
+
any::ivmte
|
|
22
|
+
any::lpSolveAPI
|
|
23
|
+
any::splines2
|
|
24
|
+
any::jsonlite
|
|
25
|
+
- uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.12"
|
|
28
|
+
- run: pip install ".[dev]"
|
|
29
|
+
- run: Rscript tests/fixtures/run_oracle.R tests/fixtures/oracle
|
|
30
|
+
- run: pytest tests/test_parity.py tests/test_moments.py tests/test_propensity.py tests/test_uspline.py tests/test_datasets.py tests/test_bootstrap.py
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Builds the package when a version tag is pushed and uploads it to PyPI
|
|
4
|
+
# through trusted publishing (no API token is stored in the repository).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- run: pip install build twine
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- run: twine check dist/*
|
|
21
|
+
- uses: actions/upload-artifact@v4
|
|
22
|
+
with:
|
|
23
|
+
name: dist
|
|
24
|
+
path: dist/
|
|
25
|
+
|
|
26
|
+
publish:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment: pypi
|
|
30
|
+
permissions:
|
|
31
|
+
id-token: write
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/download-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: dist
|
|
36
|
+
path: dist/
|
|
37
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
pymte-1.0.0/.gitignore
ADDED
pymte-1.0.0/CITATION.cff
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this package, please cite the methodological papers listed under references as well as the software."
|
|
3
|
+
title: "pymte: instrumental variables and marginal treatment effects in Python"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Ronczewski
|
|
7
|
+
given-names: Alex
|
|
8
|
+
license: GPL-3.0-or-later
|
|
9
|
+
repository-code: "https://github.com/alexr951/pymte"
|
|
10
|
+
abstract: >-
|
|
11
|
+
A Python port of the R package ivmte by Joshua Shea and Alexander
|
|
12
|
+
Torgovitsky, implementing the marginal treatment effect framework of
|
|
13
|
+
Mogstad, Santos and Torgovitsky (2018).
|
|
14
|
+
references:
|
|
15
|
+
- type: article
|
|
16
|
+
title: "Using Instrumental Variables for Inference About Policy Relevant Treatment Parameters"
|
|
17
|
+
authors:
|
|
18
|
+
- family-names: Mogstad
|
|
19
|
+
given-names: Magne
|
|
20
|
+
- family-names: Santos
|
|
21
|
+
given-names: Andres
|
|
22
|
+
- family-names: Torgovitsky
|
|
23
|
+
given-names: Alexander
|
|
24
|
+
journal: Econometrica
|
|
25
|
+
volume: 86
|
|
26
|
+
issue: 5
|
|
27
|
+
start: 1589
|
|
28
|
+
end: 1619
|
|
29
|
+
year: 2018
|
|
30
|
+
doi: 10.3982/ECTA15463
|
|
31
|
+
- type: article
|
|
32
|
+
title: "ivmte: An R Package for Extrapolating Instrumental Variable Estimates Away From Compliers"
|
|
33
|
+
authors:
|
|
34
|
+
- family-names: Shea
|
|
35
|
+
given-names: Joshua
|
|
36
|
+
- family-names: Torgovitsky
|
|
37
|
+
given-names: Alexander
|
|
38
|
+
journal: Observational Studies
|
|
39
|
+
volume: 9
|
|
40
|
+
issue: 2
|
|
41
|
+
start: 1
|
|
42
|
+
end: 42
|
|
43
|
+
year: 2023
|
|
44
|
+
doi: 10.1353/obs.2023.0016
|
|
45
|
+
- type: software
|
|
46
|
+
title: "ivmte: Instrumental Variables: Extrapolation by Marginal Treatment Effects"
|
|
47
|
+
authors:
|
|
48
|
+
- family-names: Shea
|
|
49
|
+
given-names: Joshua
|
|
50
|
+
- family-names: Torgovitsky
|
|
51
|
+
given-names: Alexander
|
|
52
|
+
repository-code: "https://github.com/jkcshea/ivmte"
|
|
53
|
+
license: GPL-3.0
|