Skip to content

Propensity score Joint Estimation Versus 2 stage Estimation #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2243004
add new data set
NathanielF Jul 6, 2025
b4ee4f1
adding latent prop_score notebook
NathanielF Jul 6, 2025
96098cb
using ps in outcome model
NathanielF Jul 7, 2025
a834d84
adding spline function on the propensity score
NathanielF Jul 8, 2025
71b3741
adding centred and non-centred options
NathanielF Jul 8, 2025
acd8112
tidying
NathanielF Jul 8, 2025
e094981
proving feedback issue and corrective
NathanielF Jul 9, 2025
ad4e6c3
update with write up
NathanielF Jul 9, 2025
0fd40cc
tidying spellings
NathanielF Jul 9, 2025
e9df0d5
improving the simulation study
NathanielF Jul 10, 2025
a18f83b
full run through
NathanielF Jul 10, 2025
8ab06ac
adding plots of prop score distributions
NathanielF Jul 11, 2025
d2035f8
adding some tests and a conclusion
NathanielF Jul 11, 2025
6aea139
adding video resource and notebook to how-to
NathanielF Jul 11, 2025
ec8173f
adding some more test coverage
NathanielF Jul 11, 2025
6f3aa02
fixing spelling error
NathanielF Jul 11, 2025
127698a
adjusting for some Juan's comments
NathanielF Jul 12, 2025
e88e4c0
fixing typos
NathanielF Jul 12, 2025
b48b82c
adding datasets
NathanielF Jul 12, 2025
0c806b8
remove beta_ps interaction
NathanielF Jul 12, 2025
98cca2f
fix observed keyword for student liklihood
NathanielF Jul 13, 2025
855b499
demonstrate the usefulness of spline component
NathanielF Jul 13, 2025
6160a3f
update colour scheme on graphs
NathanielF Jul 13, 2025
a58f671
update with ben's comments
NathanielF Jul 18, 2025
2970854
add new data set
NathanielF Jul 6, 2025
e6d9b30
Merge branch 'main' into propensity_score_latent
NathanielF Jul 18, 2025
e6f6a53
add reference
NathanielF Jul 19, 2025
2da3007
add simple regression to highlight effect of prop score,
NathanielF Jul 19, 2025
548d723
allow priors on propensity score parameters
NathanielF Jul 19, 2025
05fccdd
remove redundant alpha parameter in model class
NathanielF Jul 19, 2025
ae451cd
add winsorisation option and better priors for nhefs
NathanielF Jul 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions causalpy/data/PISA18sampleScale.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
PV1READ,Female,ESCS,METASUM,PERFEED,JOYREAD,MASTGOAL,ADAPTIVITY,TEACHINT,SCREADDIFF,SCREADCOMP
-1.982624821,0,0.877953978,-1.759454259,0.275538553,-0.314180898,1.521829065,0.388062105,1.490077639,-0.127053949,0.192197154
1.415445876,0,1.214043851,0.23043541,0.275538553,0.192481997,0.872934925,0.491332618,1.585005277,0.162136401,-0.063690149
0.671957618,0,-0.059916358,-0.573768705,0.511388315,1.252481831,-0.417835454,1.390434411,0.34360293,-1.99944701,1.547448742
1.036243451,0,0.139992977,-0.573768705,-2.061078101,-1.325941101,-0.18551145,-0.8111262,-0.668887592,0.559200856,-0.579580169
-0.274977064,0,0.855890063,-0.171666648,-0.474901312,0.420666213,1.521829065,-0.682732704,0.03540737,-0.801004811,0.956200917
1.4452046,0,0.779230785,1.024329216,-0.403642927,0.294930056,-0.873789642,0.080450276,0.69564399,-0.265544842,-0.063690149
0.329604055,0,1.234465801,1.416120964,0.275538553,0.046686765,0.184970967,0.491332618,-0.985064735,-0.265544842,-0.579580169
1.093278937,0,0.04937699,-0.171666648,0.275538553,0.001089061,-0.873789642,0.388062105,1.585005277,0.19103636,0.192197154
0.826004725,0,1.319745399,1.024329216,0.73707214,0.209996995,-0.643770024,0.388062105,-0.1710496,-0.83143084,0.956200917
0.492900607,0,0.332718712,1.024329216,-0.789077206,0.974688096,0.184970967,0.18094221,-0.1710496,-0.69885347,-0.063690149
-1.823696522,1,0.043835356,-1.759454259,-0.789077206,-0.264571379,-0.300835494,-0.232834485,-0.350262763,0.559200856,-0.929939088
-1.694857875,0,0.156412635,-0.171666648,1.059864877,0.515775586,1.521829065,2.182676695,1.585005277,0.985642167,-0.063690149
-0.397403976,1,-0.297488284,0.23043541,-0.403642927,0.528202428,0.184970967,-0.8111262,-0.797337882,0.19103636,-0.549400465
-0.622815763,1,-0.906862838,1.024329216,1.478217432,-0.403810719,1.521829065,0.826614461,-0.1710496,0.559200856,-2.407189841
0.542771496,1,0.408043893,-1.759454259,0.275538553,1.079288837,-0.873789642,-1.819287211,-0.668887592,-0.265544842,-0.063690149
0.726875163,0,-0.140270059,-0.573768705,-1.259421273,0.546695917,-1.60155663,1.226382487,-1.00358201,-0.265544842,-0.549400465
0.657727702,1,-0.366861338,0.23043541,-0.789077206,2.754466272,-0.417835454,-1.211704645,-1.922102683,-1.99944701,1.547448742
-0.286716745,0,1.429346616,-1.759454259,0.275538553,1.021264291,0.597875035,2.182676695,0.69564399,1.67370918,0.431074079
1.106085861,1,-0.367066584,0.23043541,0.511388315,1.18809709,-0.090298412,-0.020736302,0.963293103,0.19103636,-0.272021555
-1.754788984,0,-0.99224506,-0.171666648,0.316202305,-0.248230571,1.521829065,-0.8111262,-0.1710496,0.285652728,-0.951887964
0.672511922,0,0.259240743,0.23043541,1.478217432,-1.325941101,-0.417835454,1.390434411,0.673934081,0.768558646,0.464180299
1.289527671,1,1.988025477,0.23043541,1.478217432,2.231560418,0.83522679,0.388062105,0.246227606,-1.308804753,1.547448742
-1.336462565,1,-0.519872026,-1.759454259,0.142800448,-0.255373559,1.521829065,-0.339925543,-2.716749175,0.985642167,-0.063690149
0.747400989,0,0.003401948,1.416120964,0.021680557,-0.067013947,-0.300835494,0.080450276,-0.797337882,-0.69885347,0.956200917
-0.363566561,0,0.002067851,-0.171666648,0.275538553,0.294930056,-1.60155663,-0.020736302,-0.985064735,0.907717195,-0.549400465
-0.195090981,1,-1.446145978,0.622227158,0.275538553,-0.931413331,0.184970967,-0.017726175,-0.1710496,0.19103636,-0.549400465
1.451417778,1,0.757577361,1.024329216,0.021680557,0.001089061,0.184970967,0.385051978,0.963293103,1.008247085,-1.495945707
-0.598881376,0,0.900223139,1.416120964,1.478217432,0.821847725,-0.055208898,0.491332618,0.366696312,0.66554889,-0.549400465
-1.220265378,0,0.363916062,-0.171666648,1.478217432,0.394638339,-0.300835494,2.182676695,1.585005277,-0.022041226,0.919345098
-1.472374803,1,-1.359327037,-0.171666648,-0.631456757,-1.258620886,-0.38316492,-1.357348484,-1.414899633,0.66554889,-1.08422139
0.505583433,1,-0.074899296,0.23043541,1.478217432,0.294930056,1.521829065,0.488206717,1.585005277,0.19103636,0.575753748
1.542836711,0,0.598101433,1.416120964,-0.184639576,-0.116525616,0.455841064,-0.229592809,-0.1710496,-0.69885347,-0.677069756
-0.208609401,1,0.795855689,-1.759454259,0.803392783,1.402680275,1.521829065,2.182676695,-0.1710496,-1.99944701,1.547448742
-0.342329239,0,-1.580376682,1.024329216,-0.789077206,0.724487821,-1.797115203,-0.8111262,-1.732779514,1.804855859,-0.851380406
0.361282163,1,-0.908094313,0.23043541,-2.061078101,-0.639137922,-1.689751766,0.080450276,-1.281128287,-0.265544842,1.547448742
-0.872707969,1,-0.594478846,0.622227158,-1.464579584,-0.721722604,-0.516924051,-0.017726175,-1.00358201,0.559200856,-0.951887964
0.157240068,0,-0.736816756,1.024329216,-2.061078101,0.324578348,-1.199127044,1.390434411,1.585005277,1.008247085,-0.549400465
-0.417102481,0,-2.932843381,0.622227158,-0.087530663,0.515775586,0.184970967,-1.357348484,-0.723694468,1.67370918,-1.180064812
-0.496781734,1,0.04003831,0.23043541,-1.569240337,0.161365967,1.521829065,-0.8111262,-0.668887592,1.008247085,0.192197154
0.230400034,1,0.38751932,1.416120964,0.275538553,0.461175761,0.184970967,-0.336568094,-1.039126663,-0.69885347,-0.827785365
-1.591194597,1,0.132706754,-1.367662511,-2.061078101,-2.45551168,1.521829065,-2.763772459,-0.1710496,0.66554889,-0.851380406
-0.523644835,1,0.468283513,0.23043541,0.275538553,0.209996995,-0.055208898,0.491332618,1.585005277,-0.265544842,-0.063690149
0.391967486,0,-0.513509408,1.416120964,-0.789077206,-1.223786589,-0.516924051,-0.336568094,0.366696312,-0.265544842,-0.549400465
1.594800722,0,-0.249358161,-0.573768705,1.478217432,2.754466272,-2.121509901,0.491332618,1.049068524,-1.99944701,1.547448742
-0.815010626,1,-2.299762945,0.622227158,-0.214459661,-0.067013947,-0.300835494,-0.336568094,0.296139111,-0.233592742,-0.929939088
-0.842676229,1,-0.019996065,1.024329216,-0.631456757,-2.45551168,0.033719451,-0.935467601,-0.96654746,-1.15896371,-1.334072752
-0.251671441,1,-1.804094521,-0.171666648,0.275538553,-0.067013947,-1.302929157,-0.8111262,-0.985064735,0.559200856,-0.063690149
-1.291357043,0,1.381421739,0.622227158,-0.789077206,0.180348702,0.184970967,-0.336568094,-1.039126663,0.985642167,-0.063690149
1.440488872,0,1.496051476,-0.573768705,-0.087530663,0.422427498,-1.913277205,0.826614461,1.049068524,-1.99944701,1.547448742
-0.746541568,1,0.261087954,0.23043541,1.478217432,-1.507059876,1.521829065,2.182676695,1.585005277,-1.99944701,1.547448742
-0.461058027,0,0.808580923,-1.759454259,0.275538553,-0.248230571,-1.689751766,0.388062105,-0.1710496,0.985642167,-0.851380406
-2.05863077,0,-1.36804998,-1.759454259,1.478217432,0.209996995,-1.797115203,-0.339925543,1.585005277,-1.99944701,-2.407189841
-1.903996265,0,0.602001102,-1.759454259,-0.789077206,0.331819185,0.184970967,-0.8111262,-0.1710496,0.583713362,-0.851380406
0.771732489,1,0.021155703,-1.759454259,0.275538553,-1.731525825,-0.873789642,-0.8111262,-1.26622933,2.447903795,-1.495945707
0.169352043,1,-0.811936691,-1.759454259,-0.789077206,0.180348702,-0.300835494,0.708409087,-0.1710496,0.19103636,-0.579580169
1.116874123,1,0.166161807,0.23043541,1.478217432,2.754466272,0.612434565,0.826614461,0.652011331,-1.99944701,1.547448742
-1.08873794,0,0.327177078,-0.573768705,0.275538553,-0.486982495,-0.055208898,0.388062105,-0.1710496,0.985642167,-1.180064812
-0.61148147,0,-1.230740591,0.622227158,-0.214459661,-0.352439915,1.521829065,0.080450276,0.296139111,1.67370918,-0.063690149
1.260612814,0,1.54243701,-0.573768705,0.937486347,0.275555925,0.455841064,0.711766537,0.69564399,-0.265544842,1.547448742
1.195800514,0,0.703289867,1.024329216,-0.087530663,0.294930056,-0.516924051,0.491332618,-0.1710496,-1.273037476,1.547448742
1.374427317,1,-0.415299329,0.23043541,0.275538553,-0.906657496,1.521829065,-0.686321701,1.585005277,0.19103636,-0.549400465
0.2949145,1,1.102184932,-0.573768705,0.612660422,-2.45551168,1.126626871,0.823025463,0.69564399,0.66554889,-0.063690149
-1.626057889,1,-0.803624239,-1.759454259,0.105234886,1.072537245,0.83522679,-0.336568094,0.320190283,2.447903795,1.547448742
1.526191019,1,0.442935666,0.23043541,0.021680557,0.650318166,0.033719451,-0.336568094,-1.00358201,-0.233592742,-0.929939088
-0.202214212,1,0.902583465,0.622227158,1.478217432,-0.873095238,0.033719451,-1.819287211,0.566448752,-1.15896371,-1.414003239
0.767372509,1,0.527394281,-0.573768705,-2.061078101,0.821847725,0.289611039,-0.8111262,-1.26622933,0.66554889,-0.063690149
0.164173016,0,0.414714379,0.622227158,-0.789077206,-0.248230571,-0.300835494,-0.8111262,-0.1710496,-0.265544842,-0.063690149
-0.973095058,1,-1.051458451,0.23043541,1.478217432,0.312542903,-0.300835494,2.182676695,1.585005277,0.985642167,-0.063690149
0.282876984,1,0.736642297,0.622227158,1.059864877,0.411076996,-0.516924051,0.388062105,1.585005277,-0.69885347,1.547448742
0.591533776,0,1.871856397,1.024329216,0.401499366,-0.135899748,0.744308289,-0.8111262,-0.985064735,-0.69885347,1.547448742
2.033346858,0,1.043895146,0.622227158,-0.509271864,0.209996995,-0.055208898,-0.336568094,-0.668887592,-0.69885347,1.547448742
1.281130367,1,0.532628047,-0.171666648,-0.789077206,0.778304853,0.184970967,-0.8111262,-1.703407285,-0.69885347,-0.063690149
0.033042691,1,-0.76421706,-0.171666648,-0.789077206,0.209996995,0.597875035,0.388062105,1.049068524,0.985642167,1.547448742
-0.951477169,0,0.645821064,-0.573768705,0.275538553,-0.132866424,-0.300835494,-0.686321701,0.990856172,0.66554889,-0.063690149
-0.54553574,0,-1.410433222,0.622227158,-0.789077206,-0.494908276,-0.055208898,-0.447363924,-0.723694468,0.66554889,-0.929939088
-1.414660914,1,-1.619681238,1.416120964,0.612660422,0.528202428,1.521829065,-0.020736302,0.910614649,-0.158719911,-0.063690149
0.860297166,1,0.44632222,1.024329216,-1.569240337,0.294930056,-1.797115203,-0.814946745,0.673934081,0.19103636,-0.549400465
-0.289604094,1,-1.021389952,-0.965560453,-2.061078101,0.046686765,-0.873789642,-0.690026473,-0.1710496,-0.265544842,-0.063690149
-0.674208923,1,-1.035757153,-0.171666648,-0.403642927,-2.45551168,1.521829065,-0.339925543,-1.281128287,-0.265544842,0.575753748
1.13748268,1,1.217122537,1.416120964,-0.279328027,-0.473968559,-0.516924051,0.080450276,0.366696312,-1.273037476,0.919345098
0.575351384,0,-1.099691196,1.416120964,1.478217432,-0.835912562,1.521829065,1.226382487,0.320190283,-1.99944701,1.547448742
0.299373758,0,0.257393531,-0.171666648,0.021680557,-0.812428766,-0.055208898,0.491332618,-0.1710496,0.66554889,0.956200917
-0.701584963,0,-1.148026564,-1.367662511,-0.214459661,-1.258620886,-0.055208898,-0.8111262,0.320190283,-0.404131115,-0.851380406
-0.796337998,1,0.666756128,-0.573768705,-0.214459661,-0.067013947,0.184970967,0.388062105,0.673934081,0.162136401,-0.063690149
0.017910996,1,-1.206008481,0.23043541,0.021680557,-0.416726806,-0.873789642,-0.339925543,1.585005277,0.19103636,-0.063690149
0.263385309,1,-1.740365724,0.622227158,0.021680557,-1.731525825,0.455841064,0.388062105,-0.668887592,0.66554889,-0.549400465
1.539717712,1,-0.991937191,1.024329216,-2.061078101,0.821847725,0.184970967,-2.763772459,-0.1710496,-0.265544842,-0.063690149
-0.495549026,1,1.06914037,-1.759454259,-0.789077206,-0.403810719,-1.081603359,-0.8111262,-0.985064735,0.559200856,-1.009046493
-0.632073481,0,-0.646713883,0.23043541,0.275538553,-0.365356003,0.047545767,0.388062105,0.296139111,0.285652728,1.547448742
0.05442893,1,1.417237118,-1.759454259,1.478217432,-1.731525825,-1.797115203,2.182676695,-0.668887592,-1.99944701,1.547448742
-1.53764213,1,-0.561639531,-1.759454259,-1.108771753,1.637126836,-0.873789642,-0.8111262,-1.26622933,0.313217375,0.956200917
0.353563261,1,1.516883917,0.23043541,1.478217432,-0.067013947,0.455841064,0.943546319,-0.668887592,0.641417901,-1.180064812
-1.698183704,1,0.53344903,-0.171666648,1.478217432,-0.95685411,0.184970967,0.385051978,-0.668887592,0.985642167,-0.929939088
0.535474528,1,1.457567903,0.622227158,0.803392783,0.477810116,0.597875035,0.388062105,1.585005277,-0.83143084,1.547448742
-0.521444163,1,-1.246749758,-0.171666648,-0.789077206,-0.091280536,1.521829065,-1.824265498,-1.703407285,-0.233592742,-0.874335271
0.405932659,0,-0.106815006,-1.759454259,1.059864877,-0.47719758,-0.055208898,0.391188007,0.320190283,-0.265544842,-0.063690149
1.382758437,0,1.112755087,1.024329216,-1.363017023,0.546695917,-0.300835494,0.488206717,0.990856172,0.19103636,-0.063690149
-0.180166117,0,-0.903784153,1.416120964,-0.789077206,0.3589234,-2.209705037,-1.353064842,-0.668887592,0.689393741,-0.929939088
-0.138452609,0,-1.523831485,-0.171666648,0.021680557,-0.050770988,1.521829065,-0.8111262,-0.039406676,0.66554889,-0.851380406
0.907727459,1,0.115773982,1.024329216,1.478217432,0.461175761,-0.873789642,0.080450276,-0.668887592,-0.265544842,-0.063690149
3 changes: 3 additions & 0 deletions causalpy/data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"risk": {"filename": "AJR2001.csv"},
"nhefs": {"filename": "nhefs.csv"},
"schoolReturns": {"filename": "schoolingReturns.csv"},
"pisa18": {"filename": "PISA18sampleScale.csv"},
"nets": {"filename": "nets_df.csv"},
"lalonde": {"filename": "lalonde.csv"},
}


Expand Down
Loading