Skip to content
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

Add example of multiple geo lift test analysis #338

Merged
merged 24 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
347a23c
initial commit getting things into place
drbenvincent May 7, 2024
f977d87
change to the correct (initial) data simulation function
drbenvincent May 7, 2024
c0d35b4
respectable first stab at individual target geo analysis approach
drbenvincent May 7, 2024
d59c2bc
add the second method + polish the notebook somewhat
drbenvincent May 7, 2024
0633b8f
swap order and relabel as unpooled and pooled approaches
drbenvincent May 7, 2024
a076e92
Merge branch 'main' into multi-cell-geolift
drbenvincent May 7, 2024
404fcfe
Update interrogate_badge.svg
drbenvincent May 7, 2024
8aa1040
add ipywidgets as an optional dependency (for docs)
drbenvincent May 8, 2024
4f76c6c
update simulated dataset + polish notebook
drbenvincent May 8, 2024
ab7363d
tweak plot_forest sizing
drbenvincent May 8, 2024
1bf1b6f
Merge branch 'main' into multi-cell-geolift
drbenvincent May 8, 2024
5975d68
' -> "
drbenvincent May 8, 2024
b190c68
use tab20 colormap
drbenvincent May 8, 2024
d3b9be4
add hide-output cell tags
drbenvincent May 8, 2024
c7b5162
ensure we don't get negative values in simulated data
drbenvincent May 17, 2024
61f83c6
add section "Comparing the two approaches"
drbenvincent May 17, 2024
b7a5a9e
add test for generate_multicell_geolift_data
drbenvincent May 17, 2024
21dd051
also put generate_geolift_data under test
drbenvincent May 17, 2024
d19879f
Merge branch 'main' into multi-cell-geolift
drbenvincent Jun 19, 2024
0bf9801
Merge branch 'main' into multi-cell-geolift
drbenvincent Jun 19, 2024
69ad264
update aggregate geo plot + re-run notebook + run pre-commit checks
drbenvincent Jun 19, 2024
7df2dd4
fix typo
drbenvincent Jun 19, 2024
43fd5e2
use az.plot_forest functionality for simplified comparison plot code
drbenvincent Jun 19, 2024
f89c53b
replace lots of separate forest plots with one comparison forest plot
drbenvincent Jun 19, 2024
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
Next Next commit
initial commit getting things into place
  • Loading branch information
drbenvincent committed May 7, 2024
commit 347a23ca84a97828c9c916fd8674c5dca13002a5
1 change: 1 addition & 0 deletions causalpy/data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"sc": {"filename": "synthetic_control.csv"},
"anova1": {"filename": "ancova_generated.csv"},
"geolift1": {"filename": "geolift1.csv"},
"geolift_multi_cell": {"filename": "geolift_multi_cell.csv"},
"risk": {"filename": "AJR2001.csv"},
"nhefs": {"filename": "nhefs.csv"},
}
Expand Down
101 changes: 101 additions & 0 deletions causalpy/data/geolift_multi_cell.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
a,b,c,d,e,f,g,counterfactual,causal effect,actual
0.7510533170207264,2.662655757793811,-1.7736593657099187,-0.08610268874940316,-0.43456085612296136,1.6456406901258376,2.207941171486418,0.7547074536472803,-0.0,1.2161504153220957
1.1560831589720344,2.048432658888575,-0.4443328271112231,0.3832289815312787,-0.15164528450719142,2.7676258973367798,1.8570934356921578,1.1941773203032113,-0.0,1.4831190680726825
1.4312927043780972,2.2025880001583094,0.019322147323707402,0.21843167044097578,0.1351424483221587,2.890906970516219,3.110204209932617,1.6196930332756958,-0.0,1.5730224151517322
1.4838147305785057,1.8970155024889328,0.6947796115291945,1.1198986232809842,0.8750796146193227,2.8041651163417205,3.1352400997497973,2.031462104285848,-0.0,2.006944847320196
1.955366650834714,1.5188886240054722,1.2624819319814151,1.1400634695245937,0.6430201270191437,3.9243713216666825,3.029597645143273,2.4301561076267193,-0.0,2.7330634995710303
2.665204740526509,1.7662460944337601,1.408582221725877,1.0370615171377602,0.7836440958343449,4.1114527566316275,4.567089571536481,2.8166549241650323,-0.0,3.251558113633441
2.3947421474790636,1.0510863410353593,1.9470498426071434,1.2563377307377614,0.9813720973212696,4.923437843156421,4.406374266516608,3.192104742717117,-0.0,3.7527849812269993
2.621201209459468,1.363950673058025,2.538650387507814,1.5848182226049767,1.2531310869001924,4.638825564879527,5.1564946051650935,3.55835962865851,-0.0,3.235866392459406
2.868677846084793,0.854926493338314,2.2212395755162055,1.74811223408558,1.6070913751418292,5.097250943240194,4.893380091503336,3.9173778489450046,-0.0,3.628491761490537
3.0060879231560635,0.9707408618537103,2.8894354132776803,2.3920100714070087,1.6029241007849526,5.683363473499433,5.220742805648849,4.259862044271311,-0.0,4.6578203649594165
3.819435660368511,0.5625327958696371,3.1879435142568178,2.410187065098295,2.3305005323219925,5.776917257285655,5.534164609303661,4.437608782884423,-0.0,4.6828858890947735
4.2403210879342055,0.3279282975210116,3.7816822546009337,2.3591639270485314,1.8396449809325353,6.2777527400534705,5.691364546206741,4.57926684681245,-0.0,4.69312960064805
4.145978870379925,0.20066513105485523,3.5742192477775374,2.90104023362957,2.2179752460441904,6.675322365684252,5.709911371970667,4.699519418484853,-0.0,4.992257175684667
4.358542979279631,0.5893824603741015,3.3267794375204702,2.8316629154361608,2.0822791557412113,6.951065802818353,6.358166107725011,4.810309961245214,-0.0,4.30942645319011
4.462908368997536,0.9725662213924116,3.4216110144745135,2.9699872545069885,2.0508103052959785,7.202788473225825,6.247861257900751,4.921740302011239,-0.0,4.649746910277827
4.522419370839819,1.086141138973571,2.9589618440911023,3.0300349242768294,2.3860043144250853,7.309014568667632,6.418832274359641,5.045108494585513,-0.0,4.6904291076030376
5.202447205200958,1.1455264704771717,3.215037929237655,3.1735277059334264,2.4388974157051324,7.6989788242208945,6.235633603153506,5.189752913257098,-0.0,5.158155950692351
4.986165714297203,1.5553709412767165,3.479569150505114,3.7388995289906233,2.29790781944454,8.602081763367378,6.781267665332169,5.363945122661732,-0.0,5.887203759911809
4.779622051505257,1.7121708848528723,3.0651648863606407,3.695084565769912,2.6255157310815505,9.240003437128616,6.6812997586345055,5.575021998967115,-0.0,5.28180856555044
4.225625488844809,1.4709871910424004,3.621323735918852,4.746151435315827,2.937075035100439,9.489692661423751,7.078491020068364,5.82905087988086,-0.0,6.264004146876526
4.279085768943202,1.599515788415216,3.8937272358519817,4.5467816734892414,3.0470232749719104,9.827987476462619,8.073696890153121,6.127456131123525,-0.0,5.870361315621322
3.89659888813106,1.6839811572062087,4.017132997907075,4.605939344871285,3.3379869074079442,10.203567971494707,7.789410495883844,6.473370669952424,-0.0,6.774868063752808
3.875449335983685,1.6370645533194617,4.727521291932334,5.964459818419746,3.615462201849906,10.909192553056405,8.360091257449392,6.865331594739444,-0.0,6.586466773331796
3.6180992617370418,2.4638314424249965,4.779883830764443,5.863375442932144,3.454861569813905,11.321649885625225,9.129820710800937,7.297096538745462,-0.0,7.204274624837001
3.3900593406674395,2.0421712831307883,5.7494379510419815,5.933248687775699,3.9092619979941574,11.644691553345618,9.105694172633605,7.758905883041569,-0.0,7.450407492810663
2.8346160397708386,1.6650711653246744,6.805838543238307,6.732027659344467,4.160368452587775,11.741702487565695,10.162986426044862,8.237679806847325,-0.0,8.397596891424495
3.507906080400381,2.3668534377651445,7.364025479505717,6.773193174466446,4.187300656809138,11.883252123945013,10.172508855535982,8.724301225233733,-0.0,8.718033818835275
3.7396247059011385,2.0016951376558394,7.6503715491156115,6.825016349892836,4.377559263875356,11.769441202788984,10.519308232708067,9.216872409471607,-0.0,9.441621438541066
3.8728770327969837,2.176142736371828,8.444816998867045,7.442062284403953,4.383247629405813,12.39170571894681,11.270999870917759,9.717719354341165,-0.0,9.943169289235207
4.277274819418193,2.163071053918529,9.836677613133089,8.190763545459882,4.221824231164302,11.953955510331667,11.951187029336555,10.231744471273858,-0.0,10.208861837071323
4.496881417478211,2.4850228263380507,10.317984153100193,8.152998999045298,3.711506640993559,12.796590548995669,12.303183128989355,10.759918638375176,-0.0,10.765963081728028
5.432346576060468,2.777748957028294,10.979709087831448,8.54033462568401,3.618036524972256,12.602815761439276,12.735155741549999,11.291639575291414,-0.0,11.06104759493042
5.493911976304006,2.7443942899399216,12.210232529667785,8.275658110085972,3.659966591918753,13.183563932334696,13.591144711068983,11.811808195812057,-0.0,11.345131451818965
6.427186058433604,2.5888161320254364,13.108606500084232,8.532361235434735,3.128934813066003,13.245188885637246,14.053938427118892,12.30696412703407,-0.0,12.652299098040885
7.219885905935215,2.9427413742101773,13.713843188877261,8.424020091870544,2.7085338101310237,13.34540281964827,13.602412525183102,12.76386379359943,-0.0,12.923563530170885
7.5765674667650424,3.6614900244226116,14.583266741592192,8.58831435345163,2.5502826177310536,13.984302784548326,14.209027328433136,13.176341236372162,-0.0,13.272231649930037
8.347928939505632,4.029920468170675,14.742923067247318,8.225534064664608,3.1189649695281587,14.051621419194932,14.757089383836808,13.54266060148409,-0.0,13.74526100896912
8.776839936427402,3.8397228081651633,15.70025390034376,8.108105600136902,2.5515196478189806,14.71671323229837,15.305790823088886,13.863512260370884,-0.0,14.092806126064657
9.461809649188863,4.235037211142616,15.736054456096436,8.855279707285327,2.7860649815034915,15.031473934817926,15.649486657743681,14.141605270898909,-0.0,14.053592619056445
9.415324952868806,3.8153469329169716,15.521806913549982,8.690303530628151,2.9606357324108004,15.778926250820147,15.634269798297323,14.385412323448309,-0.0,13.943164450206227
10.5823450286981,4.790945222101317,15.832048946729426,8.533595193313687,3.5533331801498194,16.37533248363092,15.732556517465616,14.598426619879081,-0.0,14.910576386499761
10.058073817134263,4.7945795943937854,16.281432415806666,8.64619617802455,4.066802158161905,16.352606737647726,15.859224046665837,14.780144799516593,-0.0,14.991441106255268
10.595722204702192,4.381700738224849,16.214846869089634,8.577263783448613,4.572514757208923,16.57202142567392,16.320991808495553,14.928891400200106,-0.0,14.824295241244142
10.093390782551703,4.872462541547258,16.223068066866905,8.532362090965583,4.423316295516663,16.681291920399747,15.896235941894309,15.044613377920918,-0.0,14.754998562156128
9.892633819111493,5.797076027482992,16.32285969346228,8.87321465415663,4.8577963176931425,17.31158263854788,15.781824188344572,15.132118143930676,-0.0,15.017577847917709
9.736431258051487,5.784026277973135,16.383429386945533,8.862478230842429,4.806416768344277,17.036002457427653,16.07926666963275,15.203223988521028,-0.0,15.091041618238739
10.325587476668273,6.16186974369227,16.4895713914327,9.071265574158629,5.017813409228667,17.55541254603802,15.573329594544335,15.272649012109554,-0.0,15.449366384958786
10.059312244211775,6.9860478850637255,16.89163051977196,8.942851054304835,5.979579553427412,17.27748386437237,15.656262937042237,15.353131680483944,-0.0,15.03113036068869
9.765547472308224,7.301347187517139,16.566778792786096,9.427804200105284,6.0531812560220635,17.090657749036605,16.051856347865822,15.450452004155611,-0.0,15.216526794165373
9.890010896328326,8.707039876886853,17.095560809880837,9.352103000938767,5.726804462619083,17.0454093708242,15.884210355436602,15.571393095084034,-0.0,15.667668371928642
10.0391475746719,9.270850490682916,17.554951440568395,9.126693919411766,5.883700409420319,16.838860150407342,15.789533662024288,15.727254240682166,-0.0,15.711068739762347
10.046476200027886,9.113893327779362,18.26138609994595,9.418610634194202,6.048588680365554,16.338042509820795,16.046627679498044,15.92161136768501,-0.0,15.802556000150046
9.797281130723384,10.259711760804308,18.70810412508793,9.569428803942088,6.0383322409642695,16.606125428349703,15.960227299289254,16.150133823386124,-0.0,15.866111240424981
10.153900999596154,10.902768440074949,19.57011295159581,9.846754524737939,5.996552617561971,16.500620694945614,16.36232498342006,16.410954641761975,-0.0,16.28372877784446
9.643787325638812,12.040216299048769,19.76122520063837,10.512710655757703,5.963631516969522,16.220915706269235,16.964245827563417,16.702354261088654,-0.0,16.596000607075727
9.679777640789382,12.666411391934627,20.052430396498316,10.74125465784413,6.209061473295122,15.984755921397005,17.0513248183212,17.01688373952211,-0.0,17.08756983197565
9.90882982272456,13.037221809059416,20.47668767047379,10.568967361745937,6.6803252338900165,16.10727906093709,17.69327457318054,17.34569174502032,-0.0,16.957063188161218
10.169989472327208,13.525199146914288,20.342047044585193,11.267289176784269,6.339677354883739,16.111279285001537,18.035243838127805,17.6857373368004,-0.0,17.458863135299744
9.716396813411285,14.174220278380133,21.15411256498716,11.484636277205373,6.532468812654434,15.635643111690785,18.546189345738373,18.035127019357947,-0.0,17.926645834965324
9.229500315565438,14.281535819320167,21.152232125445856,12.19857120511381,6.9421708585794795,16.225566543617884,18.72297237533347,18.389907237060136,-0.0,18.10423373036736
9.111445570907906,14.634726431460008,22.143073887060073,12.296017099268246,7.018157698321048,16.078412917442805,18.91207764545524,18.747470226987307,-0.0,18.631666578768343
8.610317405674845,14.75511980721239,22.75094485950771,13.242822668086589,7.020237963660233,16.55715263959747,20.099327035245256,19.104899443956096,-0.0,19.282450728234707
9.679123627328266,15.251786919199175,23.240922202699636,13.687243583832837,7.3725348287257235,16.66329713920411,19.84331809818001,19.459530810956448,-0.0,19.508771180707807
9.63297298970102,15.384574881114135,23.9896450772343,14.542369897526644,8.183802427781364,16.545604449748566,20.53313053617375,19.806546189385404,-0.0,19.402920879484157
9.813958481870007,15.499803383559913,24.158908187049597,14.813864262813926,8.014262145302919,16.236508011599476,20.51535429783054,20.139684313236135,-0.0,20.782814890641042
9.775333679104959,15.879434416694446,24.52530416678439,15.135001070832297,9.015592049088072,16.647081632740264,21.210304528336668,20.45347080861946,-0.0,20.515427004189338
10.174808454109636,16.261514548574844,25.436473583618657,15.924878940881298,8.608863811869828,17.124804355000734,20.910758616657013,20.744941081785115,-0.0,20.635985196627725
10.742301088859522,16.93538166621451,25.684795594518825,16.14885445363479,8.545891041782438,17.050866086503675,20.81513336994948,21.018953711511486,-0.0,20.826484122454136
10.960960241649117,17.222572910877613,26.495717067160633,16.93096758918364,9.4120543254627,17.208953370968207,20.76833319627165,21.281711826033305,-0.0,21.23445471018477
11.92822719636096,18.153694828513835,27.115169090250593,16.884981025437373,9.970497972231328,16.925076276849268,21.23715374296591,21.54007980449721,-0.0,21.378102430850813
12.375095372606635,18.660467788139986,27.692809573218877,17.129834201654766,9.81966077856225,17.911670258833556,21.36379479700578,21.802950318324406,-0.0,21.440437757063783
13.317490538330784,18.99077301619227,27.784523092814357,17.57345464093309,10.426639887939272,17.35991166726382,21.14154827853272,22.07529765673854,-5.06888559815149e-05,22.273181006525302
13.97533776114408,19.598239063662444,28.253075956441574,18.123202002421895,10.889213547227765,17.621378239614835,21.560360839895882,22.351965993144127,-0.009547462662194911,22.383464108939847
14.319446283291104,20.67981846509571,28.289395030915536,18.256332638882174,11.123738179203086,18.144478729908993,21.90072740906663,22.628760044359403,-0.13502519657802395,22.456657169838763
15.224700590992672,20.869323285545935,29.12833726696508,18.35726611272074,11.216610657459396,18.43588793213722,21.538079053137178,22.911641588609548,-0.6615595845525153,22.639489308451058
15.738273300742593,21.2473695563024,29.242040391879733,18.699729316671448,11.86391492547363,18.52783923154373,22.25173242617043,23.214094483774822,-1.8132788707821856,21.272004363170804
15.928512555656035,21.915503031303913,29.298759638556383,19.166926590755764,12.432959038944855,18.72599441543679,21.972474559534238,23.548138782800443,-3.441924451028142,20.49017919661035
16.670315174090657,22.265554405875864,29.77193812648319,19.889316139597195,13.357099608803818,19.45788923754826,22.52280515383672,23.922486771458438,-5.0702334750295535,18.96390509333531
17.03263639785848,22.45803133396607,30.137689718200665,19.75901468460204,14.202220033170482,19.47937916043085,23.143885380327482,24.34379836639361,-6.20384586447096,18.063511876486825
17.541589377770855,23.302804757963504,30.61867247824362,20.180469885998054,15.217590121832519,19.587051986859763,23.267890745602738,24.812519994948744,-6.587782000476139,17.933767664278122
18.213296893726287,23.71513039126024,31.657378651860952,20.45017606740001,16.48933564630958,19.91468691743729,24.1377563732855,25.32249738872289,-6.255501786056686,19.123077998503867
18.933349557332043,24.460294212933583,32.84440926433696,20.48031892494586,16.687281057744947,20.08752242155469,24.35841325901565,25.85980961957314,-5.426275464910269,20.53298713546823
19.167555123042625,24.030488063189292,32.851900414924145,20.80522061135349,17.696850131198346,20.157753455381094,24.851024879418315,26.406049898311345,-4.368218995152481,22.242011420335473
20.056396067304952,24.492154277213515,33.39741455238758,20.832934734278364,18.236936560269168,20.709142376017866,25.745300300729067,26.941222295505927,-3.30269810668872,24.31365994515814
20.794028444148143,24.18241108267789,34.361892265959895,20.819979814517236,18.993786734824308,20.575046133205973,25.7976753700524,27.450786763613618,-2.3672086871194877,24.699508527856565
21.722200559577338,24.882678738095425,34.91122980469456,20.883983882694565,20.321767388908498,20.81987420083811,26.40295269927297,27.93043097419941,-1.6203583609868455,26.655600574320605
22.750370406267503,25.519573384637116,36.10093571730468,20.28955659886893,20.277551185509335,20.62096410256767,26.7781389280941,28.379217730356956,-1.0655531196403527,27.491872535868822
23.33100118421111,25.82354652652294,36.32379469130849,20.11849657177798,21.12717013087719,21.246541635630894,26.653071255336382,28.793026873465433,-0.6764583648872456,28.147762330766223
23.697314563709654,25.557731983334453,37.115436479046146,20.193631601207716,22.43795607252987,21.850519535246207,27.10672321204241,29.167101940632286,-0.4162544056547908,28.556407037519726
24.5826041036528,26.11243296223379,37.12150640602243,19.948362777319343,22.548180699088796,22.02852029627052,27.558953561661905,29.497353798314286,-0.24911175644197595,29.03364899481757
25.431232718468262,26.1843370226519,37.17334500321569,20.159610583375205,23.010661042135272,21.93569100485974,28.013863418119517,29.78767659001581,-0.14540766295862825,29.126522004925622
26.772874826503458,26.33164175856244,37.19163344881008,20.151769058437186,24.5273357630577,22.557645374223647,27.87142365325186,30.01814229828344,-0.08298440875613312,29.916910721699463
27.22977720676838,26.43681108581222,36.98912640094367,20.419476672003317,24.751905072021618,22.291998652675183,28.945883220093535,30.25282975160035,-0.04640155096083578,29.626925515164448
28.485126028221845,27.010437485135377,37.6151284155349,20.434742617865528,25.308440856130982,22.635172422099377,28.831654158530753,30.486139650637895,-0.02546738840698415,30.213102237051487
29.08936601049321,26.5113830192212,36.82255738775185,20.80142574749183,26.2043799051021,23.003643752819436,29.285632422102832,30.716571758065218,-0.013741703737374102,30.7469459828498
30.32341121431556,26.76793008741009,37.614888994569036,20.767760548159146,27.557360125651538,23.186095687656493,29.993087059403567,30.943978930405763,-0.007299699830085926,30.405139191148773
31.200711719859733,26.35332233160786,37.07831048283552,20.98808102429807,28.080395322344476,23.784575204312304,29.789111998012846,31.16854455437714,-0.003822175054299743,31.193401349597654
32.3100709448355,26.96643560785922,37.40006813644957,21.127858610920008,28.667676691658336,23.529820911510896,30.409914190932348,31.39080993613811,-0.0019748305522984235,31.296810961357853
33.38702517666829,27.21322674967126,36.718614957798906,20.950740221556263,29.46579258208551,23.44402025070675,30.55725371888066,31.61158835770106,-0.001007821827815068,31.596994132377247
33.67227219534923,27.21907615424078,36.783900567293294,21.20791861785676,30.03525051825337,23.806582839266422,31.389332781947626,31.832054236985545,-0.000508450849596291,31.713312657982584
Loading