Skip to content

Instantly share code, notes, and snippets.

@jburroni
Created February 21, 2015 18:59
Show Gist options
  • Save jburroni/1f5d061dc6e321f45eb5 to your computer and use it in GitHub Desktop.
Save jburroni/1f5d061dc6e321f45eb5 to your computer and use it in GitHub Desktop.
test with strata
{
"metadata": {
"name": "pruebas con strata"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from statsmodels import iolib\n",
"import pandas\n",
"import statsmodels.api as sm\n",
"from stats import pscore_match as ps\n",
"from stats.weightstats import CompareMeans, DescrStatsW"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"nsw = pandas.DataFrame(iolib.genfromdta('datasets/dehejiawahha/DW2002.dta'))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"nsw['re742'] = nsw.re74*nsw.re74\n",
"nsw['re752'] = nsw.re75*nsw.re75\n",
"nsw['u74'] = nsw.re74==0\n",
"nsw['blacku74'] = nsw.black*nsw.u74\n",
"nsw['age2'] = nsw.age*nsw.age\n",
"nsw['educ2'] = nsw.educ*nsw.educ"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 178
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"reload(ps)\n",
"psm = ps.PropensityScoreMatch(nsw.t, nsw.ix[:, ['age', 'black', 'blacku74', 'educ', 'hispanic', 'married', 'nodegree', 're74', 're742', 're75', 're752', 'age2', 'educ2']] , nsw.re78)\n",
"psm.result = ps.PScoreMatchResult()\n",
"psm.compute_pscore()\n",
"#psm.common_support()\n",
"psm.fit()\n",
"1"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Optimization terminated successfully.\n",
" Current function value: 204.929500\n",
" Iterations 12\n",
" Logit Regression Results \n",
"==============================================================================\n",
"Dep. Variable: t No. Observations: 2675\n",
"Model: Logit Df Residuals: 2661\n",
"Method: MLE Df Model: 13\n",
"Date: Wed, 05 Jun 2013 Pseudo R-squ.: 0.6953\n",
"Time: 20:00:38 Log-Likelihood: -204.93\n",
"converged: True LL-Null: -672.65\n",
" LLR p-value: 1.266e-191\n",
"==============================================================================\n",
" coef std err z P>|z| [95.0% Conf. Int.]\n",
"------------------------------------------------------------------------------\n",
"age 0.3306 0.120 2.747 0.006 0.095 0.566\n",
"black 1.1330 0.352 3.218 0.001 0.443 1.823\n",
"blacku74 2.1370 0.427 5.000 0.000 1.299 2.975\n",
"educ 0.8248 0.353 2.334 0.020 0.132 1.517\n",
"hispanic 1.9628 0.567 3.459 0.001 0.851 3.075\n",
"married -1.8841 0.299 -6.292 0.000 -2.471 -1.297\n",
"nodegree 0.1300 0.428 0.303 0.762 -0.710 0.970\n",
"re74 -0.0001 3.55e-05 -2.948 0.003 -0.000 -3.51e-05\n",
"re742 2.358e-09 6.57e-10 3.587 0.000 1.07e-09 3.65e-09\n",
"re75 -0.0002 4.15e-05 -5.228 0.000 -0.000 -0.000\n",
"re752 1.581e-10 6.68e-10 0.237 0.813 -1.15e-09 1.47e-09\n",
"age2 -0.0063 0.002 -3.417 0.001 -0.010 -0.003\n",
"educ2 -0.0483 0.019 -2.597 0.009 -0.085 -0.012\n",
"const -7.5525 2.452 -3.080 0.002 -12.358 -2.747\n",
"=============================================================================="
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Using common support: [0.0006525708366325665, 0.97352552084949662]\n",
"propensity scores description\n",
"count 1325.000000\n",
"mean 0.135093\n",
"std 0.270380\n",
"min 0.000653\n",
"25% 0.002434\n",
"50% 0.010941\n",
"75% 0.075511\n",
"max 0.973526\n",
"dtype: float64\n",
"Optimization terminated successfully.\n",
" Current function value: 204.929500\n",
" Iterations 12\n",
" Logit Regression Results \n",
"==============================================================================\n",
"Dep. Variable: t No. Observations: 2675\n",
"Model: Logit Df Residuals: 2661\n",
"Method: MLE Df Model: 13\n",
"Date: Wed, 05 Jun 2013 Pseudo R-squ.: 0.6953\n",
"Time: 20:00:38 Log-Likelihood: -204.93\n",
"converged: True LL-Null: -672.65\n",
" LLR p-value: 1.266e-191\n",
"==============================================================================\n",
" coef std err z P>|z| [95.0% Conf. Int.]\n",
"------------------------------------------------------------------------------\n",
"age 0.3306 0.120 2.747 0.006 0.095 0.566\n",
"black 1.1330 0.352 3.218 0.001 0.443 1.823\n",
"blacku74 2.1370 0.427 5.000 0.000 1.299 2.975\n",
"educ 0.8248 0.353 2.334 0.020 0.132 1.517\n",
"hispanic 1.9628 0.567 3.459 0.001 0.851 3.075\n",
"married -1.8841 0.299 -6.292 0.000 -2.471 -1.297\n",
"nodegree 0.1300 0.428 0.303 0.762 -0.710 0.970\n",
"re74 -0.0001 3.55e-05 -2.948 0.003 -0.000 -3.51e-05\n",
"re742 2.358e-09 6.57e-10 3.587 0.000 1.07e-09 3.65e-09\n",
"re75 -0.0002 4.15e-05 -5.228 0.000 -0.000 -0.000\n",
"re752 1.581e-10 6.68e-10 0.237 0.813 -1.15e-09 1.47e-09\n",
"age2 -0.0063 0.002 -3.417 0.001 -0.010 -0.003\n",
"educ2 -0.0483 0.019 -2.597 0.009 -0.085 -0.012\n",
"const -7.5525 2.452 -3.080 0.002 -12.358 -2.747\n",
"=============================================================================="
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Using common support: [0.0006525708366325665, 0.97352552084949662]\n",
"propensity scores description\n",
"count 1325.000000\n",
"mean 0.135093\n",
"std 0.270380\n",
"min 0.000653\n",
"25% 0.002434\n",
"50% 0.010941\n",
"75% 0.075511\n",
"max 0.973526\n",
"dtype: float64\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.099364564859125287, 0.19872912967338444]\n",
"Treated, Control:[18, 2415]\n",
"[-2.18797331 3.7789858 2.31144186 -1.29603793 1.91164897 -0.70787045\n",
" 1.38549404 -3.72465814 -2.07348331 -4.04044111 -2.17993103 -2.19184134\n",
" -1.64559645]\n",
"[ 2.87664443e-02 1.61253800e-04 2.08917061e-02 1.95085446e-01\n",
" 5.60386894e-02 4.79093571e-01 1.66028554e-01 2.00030233e-04\n",
" 3.82324095e-02 5.50065322e-05 2.93582136e-02 2.84855053e-02\n",
" 9.99761427e-02]\n",
"[False False False False False True False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.049646981640595625, 0.099293963236325125]\n",
"Treated, Control:[11, 2362]\n",
"[-1.55886153 3.26381494 -0.26503445 -0.70842874 -0.58784355 -0.80980723\n",
" 0.55648048 -2.01871288 -1.32186924 -2.71277245 -1.56659901 -1.71062585\n",
" -1.01265135]\n",
"[ 0.11916262 0.00111485 0.79100596 0.47874869 0.55669329 0.41813224\n",
" 0.57793495 0.04362944 0.18633922 0.00672051 0.11734189 0.08728102\n",
" 0.31133005]\n",
"[False False True True True True True False False False False False\n",
" True]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.024281833795333243, 0.048563667545800361]\n",
"Treated, Control:[7, 2255]\n",
"[-1.24317111 4.14584563 -0.16740689 -0.83824958 -0.45920438 0.85190406\n",
" 0.89901144 -0.89233691 -0.79755056 -1.67646567 -1.11526058 -1.41921486\n",
" -1.05954159]\n",
"[ 2.13933738e-01 3.51052505e-05 8.67064885e-01 4.01979191e-01\n",
" 6.46131565e-01 3.94357607e-01 3.68742342e-01 3.72307375e-01\n",
" 4.25215135e-01 9.37853201e-02 2.64857347e-01 1.55974288e-01\n",
" 2.89466422e-01]\n",
"[ True False True True True True True True True False True False\n",
" True]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.012134609438594717, 0.02426921883232331]\n",
"Treated, Control:[5, 2141]\n",
"[-0.76681378 4.46483864 -0.09669639 -1.096545 -0.36291651 0.68735955\n",
" 1.67879676 -0.33526261 -0.459322 -0.95205709 -0.81803497 -0.97301306\n",
" -1.25166978]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ 4.43276669e-01 8.42877913e-06 9.22976543e-01 2.72963487e-01\n",
" 7.16703027e-01 4.91930524e-01 9.33373806e-02 7.37459799e-01\n",
" 6.46049516e-01 3.41175347e-01 4.13428124e-01 3.30656571e-01\n",
" 2.10826756e-01]\n",
"[ True False True True True True False True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.006062509899062157, 0.012125019753258187]\n",
"Treated, Control:[5, 2017]\n",
"[-0.82260888 4.638768 -0.08625832 -1.17950975 -0.35265951 0.65603068\n",
" 1.78224634 -0.4586134 -0.52009379 -1.11618977 -0.88045348 -1.02269931\n",
" -1.32990726]\n",
"[ 4.10827539e-01 3.72951754e-06 9.31269618e-01 2.38334155e-01\n",
" 7.24380507e-01 5.11879099e-01 7.48592324e-02 6.46561146e-01\n",
" 6.03055198e-01 2.64473669e-01 3.78718434e-01 3.06572496e-01\n",
" 1.83698972e-01]\n",
"[ True False True True True True False True True True True True\n",
" False]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.0030048024974415363, 0.0060096049500169462]\n",
"Treated, Control:[3, 1888]\n",
"[-0.90232391 3.75457817 nan -0.82465852 -0.26740943 0.47269457\n",
" 1.66421874 -0.23770717 -0.286126 -0.69750531 -0.67914207 -1.00709281\n",
" -0.91384411]\n",
"[ 3.66999866e-01 1.78886520e-04 nan 4.09669604e-01\n",
" 7.89183130e-01 6.36485713e-01 9.62345769e-02 8.12134002e-01\n",
" 7.74812990e-01 4.85572454e-01 4.97131048e-01 3.14019158e-01\n",
" 3.60915388e-01]\n",
"[ True False False True True True False True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.0014901298528522636, 0.0029802596608384012]\n",
"Treated, Control:[1, 1735]\n",
"[-0.37648815 2.32292709 nan -0.51900726 -0.14753046 0.26379313\n",
" 1.79093985 -0.7318976 -0.6055945 0.07287711 -0.12334244 -0.48368179\n",
" -0.65124024]\n",
"[ 0.70660009 0.02029827 nan 0.60382191 0.88273049 0.79197067\n",
" 0.07347731 0.46432997 0.54486331 0.94191231 0.90185023 0.62867279\n",
" 0.51497771]\n",
"[ True False False True True True False True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.00074492116204806123, 0.0014898422792299964]\n",
"Treated, Control:[1, 1548]\n",
"[-0.44971971 2.52253881 nan -0.55027381 -0.14285897 0.25265589\n",
" 1.81870873 -0.83069525 -0.65078252 -0.03371227 -0.18944985 -0.54962896\n",
" -0.68701077]\n",
"[ 0.65297556 0.01175071 nan 0.58221103 0.88642017 0.8005677\n",
" 0.06914915 0.40627399 0.51528353 0.97311094 0.84976511 0.58265323\n",
" 0.49217891]\n",
"[ True False False True True True False True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [4.4866126056484088e-11, 0.00037196316392155813, 0.00074392628297699026]\n",
"Treated, Control:[1, 1377]\n",
"[-0.49040316 2.68979423 nan -0.601405 -0.13023844 0.24319705\n",
" 1.91789652 -0.91344791 -0.69042173 -0.15185614 -0.25782142 -0.58670389\n",
" -0.74336659]\n",
"[ 0.62392683 0.00723606 nan 0.54766933 0.89639682 0.807889\n",
" 0.05533092 0.36116704 0.49004545 0.87932267 0.79658329 0.55749883\n",
" 0.45738667]\n",
"[ True False False True True True False True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.00037215894067987512, 0.00055716693992223531, 0.00074217493916459544]\n",
"Treated, Control:[1, 177]\n",
"[-0.00224399 2.03927076 nan -0.22476633 -0.18626185 0.33456771\n",
" 1.52096507 -0.3121329 -0.49623641 1.36708825 1.74396513 -0.14064254\n",
" -0.36908595]\n",
"[ 0.9982121 0.04291831 nan 0.8224218 0.85245394 0.73834958\n",
" 0.13006314 0.755309 0.62034679 0.17334119 0.08291112 0.88831318\n",
" 0.7125073 ]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ True False False True True True False True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0005587866395464499, 0.00065046230642119547, 0.00074213797329594105]\n",
"Treated, Control:[1, 66]\n",
"[ 0.30707363 2.47876554 nan -0.46684841 -0.17411825 0.31147219\n",
" 1.67221786 -0.21032882 -0.39586811 1.50028886 2.01730618 0.16186072\n",
" -0.55859581]\n",
"[ 0.75976897 0.01578807 nan 0.64216942 0.8623137 0.7564385\n",
" 0.09928881 0.83406898 0.69349876 0.13838157 0.04779672 0.87191763\n",
" 0.57835691]\n",
"[ True False False True True True False True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0006525708366325665, 0.00069317973886829634, 0.00073378864110402618]\n",
"Treated, Control:[1, 30]\n",
"[ 0.42634805 2.16273423 nan -0.47018842 -0.1796053 0.1796053\n",
" 2.16273423 -0.37086137 -0.4530134 1.66242335 2.27068638 0.27767264\n",
" -0.58786362]\n",
"[ 0.67300241 0.03894556 nan 0.64173732 0.85871151 0.85871151\n",
" 0.03894556 0.7134362 0.65391041 0.10720098 0.03077168 0.78323366\n",
" 0.56117411]\n",
"[ True False False True True True False True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0006525708366325665, 0.00067262784230637436, 0.00069268484798018222]\n",
"Treated, Control:[1, 21]\n",
"[ 0.55593795 2.33549683 nan -0.8727289 -0.21320072 0.21320072\n",
" 2.33549683 -0.28528655 -0.39579459 1.72421321 2.15999085 0.4427259\n",
" -0.82922399]\n",
"[ 0.58441979 0.03004665 nan 0.39316847 0.83332864 0.83332864\n",
" 0.03004665 0.77835811 0.69644704 0.10009283 0.04309056 0.66271522\n",
" 0.41676521]\n",
"[ True False False True True True False True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0006525708366325665, 0.00066138077270742283, 0.00067019070878227916]\n",
"Treated, Control:[1, 8]\n",
"[ 0.2615031 2.33333333 nan -1.17627621 nan nan\n",
" 1.52752523 -0.23849935 -0.32860909 1.78720841 2.28670925 0.15258334\n",
" -1.14724135]\n",
"[ 0.80123191 0.05235631 nan 0.27793255 nan nan\n",
" 0.17047066 0.81832528 0.75206307 0.11705469 0.05607888 0.88303186\n",
" 0.28897644]\n",
"[ True False False True False False False True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0006525708366325665, 0.00065618975169549551, 0.00065980866675842463]\n",
"Treated, Control:[1, 3]\n",
"[ 1.63663418 inf nan -0.5 nan nan\n",
" 0.5 -0.69470912 -0.68070009 1.84527229 2.15087378 1.79653249\n",
" -0.5 ]\n",
"[ 0.24335009 0. nan 0.66666667 nan nan\n",
" 0.66666667 0.55909217 0.56629691 0.2062908 0.16443401 0.21424555\n",
" 0.66666667]\n",
"[ True False False True False False True True True True False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0006525708366325665, 0.0006525708366325665, 0.0006525708366325665]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.0030078040849525335, 0.0044971544511830074, 0.0059865048174134817]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Treated, Control:[2, 152]\n",
"[-0.17047888 1.73978155 nan 0.02037898 -0.30870343 0.49857903\n",
" 0.30050905 2.77317971 4.82850609 0.98676408 1.05646789 -0.29397783\n",
" 0.06428556]\n",
"[ 8.64860254e-01 8.39215263e-02 nan 9.83767781e-01\n",
" 7.57969834e-01 6.18796698e-01 7.64199518e-01 6.24657668e-03\n",
" 3.32343708e-06 3.25326449e-01 2.92430720e-01 7.69175897e-01\n",
" 9.48827318e-01]\n",
"[ True False False True True True True False False True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0030078040849525335, 0.0037367303364163286, 0.0044656565878801241]\n",
"Treated, Control:[1, 82]\n",
"[ 0.34791739 1.14477034 nan -1.15979649 -0.22371039 0.3248124\n",
" 1.14477034 -0.00281766 -0.2166019 1.24828292 1.60274196 0.18673015\n",
" -1.17614682]\n",
"[ 0.72880475 0.25567571 nan 0.24953898 0.82354593 0.74616047\n",
" 0.25567571 0.99775876 0.8290632 0.21552366 0.11288435 0.85233912\n",
" 0.24298138]\n",
"[ True True False True True True True True True True False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0030078040849525335, 0.0033603544007369656, 0.0037129047165213981]\n",
"Treated, Control:[1, 45]\n",
"[ 0.49048013 0.95652174 nan -0.9709558 nan 0.38361073\n",
" 1.25516834 -0.19057715 -0.39172374 1.11761638 1.35033262 0.34296797\n",
" -1.01771284]\n",
"[ 0.62623136 0.34403497 nan 0.33687783 nan 0.7031144\n",
" 0.21604324 0.84973349 0.69715318 0.26979626 0.18381437 0.73325579\n",
" 0.31437803]\n",
"[ True True False True False True True True True True False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0030078040849525335, 0.0031575747544201433, 0.0033073454238877528]\n",
"Treated, Control:[1, 23]\n",
"[ 0.37379671 1. nan -1.05116781 nan 0.29546842\n",
" 1.31101106 -0.06512396 -0.2951125 1.30401139 1.7013365 0.22011283\n",
" -1.08238402]\n",
"[ 0.71213371 0.32818326 nan 0.3045915 nan 0.77040674\n",
" 0.20337426 0.94866346 0.77067503 0.20570943 0.10297266 0.82781299\n",
" 0.29080347]\n",
"[ True True False True False True True True True True False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0031626680736282125, 0.003226710090284887, 0.003290752106941562]\n",
"Treated, Control:[1, 8]\n",
"[ 1.03041173 0.33333333 nan -1.28759261 nan 0.50917508\n",
" 2.33333333 -0.49449702 -0.58694663 0.94902953 0.88608809 0.87490092\n",
" -1.42649045]\n",
"[ 0.33709849 0.74864455 nan 0.23882009 nan 0.62628327\n",
" 0.05235631 0.63609501 0.5756724 0.37421072 0.40498069 0.41063958\n",
" 0.19676735]\n",
"[ True True False True False True False True True True True True\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.0045156408850377154, 0.0052447447152702276, 0.0059738485455027397]\n",
"Treated, Control:[1, 69]\n",
"[-0.59940705 1.30756043 nan 0.96899526 -0.21013292 0.38172541\n",
" -0.71978833 3.96707664 8.60305312 0.22142757 -0.02492403 -0.62858921\n",
" 1.03572472]\n",
"[ 5.50893460e-01 1.95426147e-01 nan 3.35981548e-01\n",
" 8.34192285e-01 7.03855321e-01 4.74122082e-01 1.77593580e-04\n",
" 1.76306095e-12 8.25423124e-01 9.80188557e-01 5.31723826e-01\n",
" 3.03999851e-01]\n",
"[ True False False True True True True False False True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0052560303378245592, 0.0056023731288483728, 0.0059487159198721865]\n",
"Treated, Control:[1, 31]\n",
"[-0.8444406 1.51382518 nan 0.92022087 -0.25427381 0.25427381\n",
" -0.71807033 3.46343789 7.52876072 0.56197735 0.27892925 -0.84367852\n",
" 0.92965656]\n",
"[ 4.05107214e-01 1.40535493e-01 nan 3.64798146e-01\n",
" 8.01018853e-01 8.01018853e-01 4.78269122e-01 1.62709936e-03\n",
" 2.15250722e-08 5.78306441e-01 7.82212951e-01 4.05526327e-01\n",
" 3.59969594e-01]\n",
"[ True False False True True True True False False True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0052560303378245592, 0.0054246220008682487, 0.0055932136639119372]\n",
"Treated, Control:[1, 20]\n",
"[-0.81861178 1.45296631 nan 0.99846907 -0.31706324 0.31706324\n",
" -0.69798244 3.37252014 7.20743326 0.47050038 0.16430246 -0.83342298\n",
" 1.01292556]\n",
"[ 4.23156872e-01 1.62549999e-01 nan 3.30599156e-01\n",
" 7.54653192e-01 7.54653192e-01 4.93642588e-01 3.19703375e-03\n",
" 7.61255352e-07 6.43353694e-01 8.71228343e-01 4.14961021e-01\n",
" 3.23822009e-01]\n",
"[ True False False True True True True False False True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0054649432733123162, 0.0055174920586539304, 0.0055700408439955445]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Treated, Control:[1, 5]\n",
"[-0.22325823 1. nan 1.42886902 nan 0.40824829\n",
" -0.40824829 5.2279346 8.8986717 -0.09693511 -0.18358651 -0.30958288\n",
" 1.73505523]\n",
"[ 8.34272649e-01 3.73900966e-01 nan 2.26245219e-01\n",
" nan 7.04000000e-01 7.04000000e-01 6.39269769e-03\n",
" 8.81341545e-04 9.27440637e-01 8.63268454e-01 7.72335204e-01\n",
" 1.57747260e-01]\n",
"[ True True False True False True True False False True True True\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.0060673411188285412, 0.0089451885453931922, 0.011823035971957843]\n",
"Treated, Control:[2, 128]\n",
"[ 0.5044977 1.78181993 -0.21739719 -0.61655437 -0.28293114 0.75950338\n",
" 0.61813393 0.60480122 -0.00493854 0.25737513 -0.09322606 0.27448776\n",
" -0.76977314]\n",
"[ 0.61477905 0.07714978 0.82824498 0.53862373 0.77768666 0.448948\n",
" 0.53758537 0.54638174 0.99606732 0.79730249 0.92586974 0.78415232\n",
" 0.44285275]\n",
"[ True False True True True True True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0060673411188285412, 0.0074879341619376013, 0.0089085272050466614]\n",
"Treated, Control:[2, 69]\n",
"[ 0.80089756 2.10776088 nan -0.82412506 -0.29723437 0.7033849\n",
" 0.80502402 1.30002054 0.93666872 0.84348373 0.63035579 0.58423007\n",
" -0.92184561]\n",
"[ 0.42594018 0.03868682 nan 0.41270821 0.76718059 0.48418266\n",
" 0.42357116 0.19791997 0.35219592 0.40187265 0.53054401 0.56097083\n",
" 0.35982123]\n",
"[ True False False True True True True False True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0075411604227087516, 0.0082108230165575998, 0.0088804856104064481]\n",
"Treated, Control:[2, 27]\n",
"[ 1.02402493 2.55288883 nan -0.68635113 -0.48245064 0.88545414\n",
" 0.86650693 1.44086689 1.51090727 0.94978534 0.76369873 0.78851319\n",
" -0.87400014]\n",
"[ 0.31491129 0.01665019 nan 0.49834407 0.63337426 0.38372998\n",
" 0.39384755 0.16111962 0.14242835 0.35064617 0.45166915 0.43726556\n",
" 0.38982603]\n",
"[ True False False True True True True False False True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0075411604227087516, 0.007872833591021762, 0.0082045067593347724]\n",
"Treated, Control:[2, 13]\n",
"[ 0.85492114 4.5607017 nan -1.22077837 -0.38005848 1.2188988\n",
" 1.10976527 1.06130282 0.9344945 0.93671709 0.71956942 0.59934287\n",
" -1.33111074]\n",
"[ 4.08074680e-01 5.34607742e-04 nan 2.43850252e-01\n",
" 7.10038868e-01 2.44539217e-01 2.87207118e-01 3.07871949e-01\n",
" 3.67083070e-01 3.65980641e-01 4.84526142e-01 5.59245266e-01\n",
" 2.06026429e-01]\n",
"[ True False False True True True True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0075411604227087516, 0.0076953763524743235, 0.0078495922822398954]\n",
"Treated, Control:[1, 5]\n",
"[ 3.12412589 inf nan -0.76376262 -0.40824829 1.\n",
" nan 1.21609517 1.33517998 -0.1760121 -0.30592604 3.77739643\n",
" -0.73867585]\n",
"[ 0.03538531 0. nan 0.48757291 0.704 0.37390097\n",
" nan 0.29080446 0.25273646 0.86883607 0.77492197 0.01947955\n",
" 0.50110023]\n",
"[False False False True True True False True True True True False\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0075411604227087516, 0.0075717489974633885, 0.0076023375722180254]\n",
"Treated, Control:[1, 2]\n",
"[ 1.44337567 inf nan -0.57735027 -0.57735027 0.57735027\n",
" nan 1.40030097 1.91283374 -3.641948 -3.07891598 1.70694862\n",
" -0.57735027]\n",
"[ 0.38572227 0. nan 0.66666667 0.66666667 0.66666667\n",
" nan 0.39479836 0.30666528 0.17059764 0.1999251 0.33737232\n",
" 0.66666667]\n",
"[ True False False True True True False True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.007592491574803492, 0.007592491574803492, 0.007592491574803492]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.0079065369387176718, 0.008052002148967171, 0.0081974673592166702]\n",
"Treated, Control:[1, 7]\n",
"[ 0.25478258 2.12132034 nan -0.92766253 nan 0.75\n",
" 1.36930639 0.7113966 0.48420196 1.076245 1.10284808 0.1107615\n",
" -0.99744139]\n",
"[ 0.80739893 0.07814075 nan 0.3893755 nan 0.48161781\n",
" 0.21994382 0.50354407 0.64540888 0.32317738 0.31235176 0.91541758\n",
" 0.35706101]\n",
"[ True False False True False True True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0079065369387176718, 0.0079582978932071537, 0.0080100588476966373]\n",
"Treated, Control:[1, 4]\n",
"[ 0.41056158 inf nan -1.71434625 nan 1.34164079\n",
" 1.34164079 0.81536719 0.91617812 0.58922936 0.56371833 0.25358312\n",
" -1.46416704]\n",
"[ 0.70895642 0. nan 0.18497728 nan 0.2722284\n",
" 0.2722284 0.47457743 0.42713385 0.59713726 0.61233645 0.81620315\n",
" 0.23936333]\n",
"[ True False False False False True True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.0079601475363377562, 0.0079636204286372379, 0.0079670933209367214]\n",
"Treated, Control:[1, 1]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.0079601475363377562, 0.0079601475363377562, 0.0079601475363377562]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.024394669916866403, 0.036377127797898874, 0.048359585678931345]\n",
"Treated, Control:[2, 113]\n",
"[-0.54147826 0.08624532 -0.3016327 0.98496406 -0.46036421 0.78548511\n",
" -1.27143611 -0.22485678 -0.55281662 -0.7576708 -0.87307553 -0.60718108\n",
" 0.98094252]\n",
"[ 0.58924398 0.93142404 0.76348647 0.326746 0.64613949 0.43381307\n",
" 0.20618433 0.82249681 0.58148094 0.45022522 0.38447343 0.54494889\n",
" 0.32871664]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[-0.54147826 0.08624532 -0.3016327 0.98496406 -0.46036421 0.78548511\n",
" -1.27143611 -0.22485678 -0.55281662 -0.7576708 -0.87307553 -0.60718108\n",
" 0.98094252]\n",
"[ 0.58924398 0.93142404 0.76348647 0.326746 0.64613949 0.43381307\n",
" 0.20618433 0.82249681 0.58148094 0.45022522 0.38447343 0.54494889\n",
" 0.32871664]\n",
"stratum min, half, max: [0.049791367460576566, 0.074376564900015416, 0.098961762339454265]\n",
"Treated, Control:[4, 106]\n",
"[-0.20850594 -0.79622424 -0.4854239 0.98423629 -0.4854239 -0.53207023\n",
" -1.08945427 -0.46508982 -0.27007967 -0.45844624 -0.40113543 -0.27609419\n",
" 0.95039161]\n",
"[ 0.83522667 0.42764843 0.62835897 0.32719917 0.62835897 0.59577021\n",
" 0.27837857 0.64280353 0.78761437 0.64755307 0.68911296 0.78300335\n",
" 0.3440353 ]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[-0.20850594 -0.79622424 -0.4854239 0.98423629 -0.4854239 -0.53207023\n",
" -1.08945427 -0.46508982 -0.27007967 -0.45844624 -0.40113543 -0.27609419\n",
" 0.95039161]\n",
"[ 0.83522667 0.42764843 0.62835897 0.32719917 0.62835897 0.59577021\n",
" 0.27837857 0.64280353 0.78761437 0.64755307 0.68911296 0.78300335\n",
" 0.3440353 ]\n",
"stratum min, half, max: [0.10033940036371164, 0.14924486935583817, 0.19815033834796469]\n",
"Treated, Control:[6, 53]\n",
"[-0.45680224 -0.48304239 -0.58974283 -0.27055974 2.01495468 1.2588019\n",
" 0.20782806 -1.524364 -1.0128259 -0.08200806 -0.51542568 -0.26552213\n",
" -0.42561919]\n",
"[ 0.64954929 0.63091586 0.55769366 0.78770696 0.04863486 0.21323312\n",
" 0.836104 0.13294737 0.31542345 0.9349276 0.60824896 0.79156525\n",
" 0.67198812]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ True True True True False True True False True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.10033940036371164, 0.1246281521978181, 0.14891690403192456]\n",
"Treated, Control:[5, 36]\n",
"[-0.51124394 -0.88442644 -0.52893331 -0.61319149 2.08487696 0.69863268\n",
" 0.80806863 -1.44816378 -0.91755179 0.45306009 -0.09364978 -0.28275287\n",
" -0.7619104 ]\n",
"[ 0.61206263 0.38188626 0.59984942 0.5433095 0.04367525 0.48892701\n",
" 0.42395279 0.15556358 0.36449328 0.65301612 0.92586684 0.77886163\n",
" 0.45069677]\n",
"[ True True True True False True True False True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.12738325268192066, 0.13420982093909933, 0.14103638919627798]\n",
"Treated, Control:[5, 10]\n",
"[-0.71833859 -2.27128381 -1.040833 0. 2.40370085 0.\n",
" 0.73598007 -1.33550891 -1.06498244 0.86270102 0.314656 -0.51745858\n",
" -0.2035776 ]\n",
"[ 0.4852594 0.04077153 0.31692426 1. 0.03186348 1.\n",
" 0.47481396 0.2046229 0.3062652 0.40393653 0.75801603 0.61352786\n",
" 0.84183569]\n",
"[ True False True True False True True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.12738325268192066, 0.13065849480396224, 0.13393373692600383]\n",
"Treated, Control:[4, 7]\n",
"[-0.55487286 -1.25436302 -1.14415511 -0.11436469 1.38169856 0.11581372\n",
" 0.54446551 -1.12387469 -0.89576936 0.5027055 0.04715331 -0.45382752\n",
" -0.34560206]\n",
"[ 0.59250195 0.24130742 0.28207649 0.91145942 0.2003942 0.91034312\n",
" 0.59934956 0.29014816 0.39370336 0.62724179 0.9634208 0.6606984\n",
" 0.7375825 ]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[-0.55487286 -1.25436302 -1.14415511 -0.11436469 1.38169856 0.11581372\n",
" 0.54446551 -1.12387469 -0.89576936 0.5027055 0.04715331 -0.45382752\n",
" -0.34560206]\n",
"[ 0.59250195 0.24130742 0.28207649 0.91145942 0.2003942 0.91034312\n",
" 0.59934956 0.29014816 0.39370336 0.62724179 0.9634208 0.6606984\n",
" 0.7375825 ]\n",
"stratum min, half, max: [0.15142045480974389, 0.17323505144111528, 0.1950496480724867]\n",
"Treated, Control:[1, 16]\n",
"[ 0.10015637 0.82841687 -0.24253563 0.68508151 -0.24253563 1.0651074\n",
" -1.21267813 -0.41698949 -0.40412251 -0.95337811 -0.81314685 -0.00296643\n",
" 0.70687581]\n",
"[ 0.92154657 0.42042093 0.81165015 0.50374238 0.81165015 0.3036727\n",
" 0.24400674 0.68259252 0.69182583 0.35551051 0.42885248 0.99767222\n",
" 0.49047991]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[ 0.10015637 0.82841687 -0.24253563 0.68508151 -0.24253563 1.0651074\n",
" -1.21267813 -0.41698949 -0.40412251 -0.95337811 -0.81314685 -0.00296643\n",
" 0.70687581]\n",
"[ 0.92154657 0.42042093 0.81165015 0.50374238 0.81165015 0.3036727\n",
" 0.24400674 0.68259252 0.69182583 0.35551051 0.42885248 0.99767222\n",
" 0.49047991]\n",
"stratum min, half, max: [0.20329229347260969, 0.29593119214494001, 0.38857009081727029]\n",
"Treated, Control:[27, 41]\n",
"[ 0.1864173 -0.14099474 0.30751039 -0.88849092 -1.1592633 -0.42349478\n",
" 0.05837009 -0.32856925 0.10690426 0.15920473 -0.3581286 0.10169362\n",
" -0.85584434]\n",
"[ 0.85268934 0.88830355 0.7594232 0.37750349 0.25052586 0.67331124\n",
" 0.95363021 0.74352154 0.91518923 0.87399376 0.72138997 0.91930819\n",
" 0.39518039]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[ 0.1864173 -0.14099474 0.30751039 -0.88849092 -1.1592633 -0.42349478\n",
" 0.05837009 -0.32856925 0.10690426 0.15920473 -0.3581286 0.10169362\n",
" -0.85584434]\n",
"[ 0.85268934 0.88830355 0.7594232 0.37750349 0.25052586 0.67331124\n",
" 0.95363021 0.74352154 0.91518923 0.87399376 0.72138997 0.91930819\n",
" 0.39518039]\n",
"stratum min, half, max: [0.40329580698758055, 0.50058277028929488, 0.59786973359100914]\n",
"Treated, Control:[20, 14]\n",
"[-0.96582135 -2.53469951 -0.90993217 -0.23458844 0.68387816 -1.46651959\n",
" 0.56537142 0.37434619 0.92514877 -1.62994629 -0.99052693 -0.73790426\n",
" -0.23704679]\n",
"[ 0.34137651 0.01634379 0.3696615 0.81602276 0.49897485 0.15226602\n",
" 0.5757641 0.71061604 0.36181317 0.11291857 0.3293478 0.46594984\n",
" 0.81413151]\n",
"[ True False True True True False True True True False True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.40329580698758055, 0.44998133464486323, 0.49666686230214585]\n",
"Treated, Control:[5, 8]\n",
"[-0.20022142 -3.18651003 -0.19180536 -0.88345343 1.30088727 -1.18754217\n",
" 0.62248776 1.15097755 1.75217247 -0.98273149 -0.82248857 -0.02001745\n",
" -0.75038563]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ 0.84496103 0.00866018 0.85138946 0.39588927 0.21988784 0.26002456\n",
" 0.54630856 0.27414641 0.10753506 0.34686086 0.42826831 0.98438793\n",
" 0.46876979]\n",
"[ True False True True True True True True False True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.40329580698758055, 0.4144059039157022, 0.42551600084382379]\n",
"Treated, Control:[4, 1]\n",
"[ -0.37727257 -0.77459667 0.4472136 0.12097168 nan\n",
" nan -0.4472136 0.27539304 0.43071013 -3.56973546 -10.28618\n",
" -0.2282643 0.30402946]\n",
"[ 0.73107867 0.49502535 0.68503764 0.91136102 nan nan\n",
" 0.68503764 0.80089324 0.69574915 0.03755913 0.00195941 0.83411475\n",
" 0.78097345]\n",
"[ True True True True False False True True True False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.40329580698758055, 0.40571492347705651, 0.40813403996653252]\n",
"Treated, Control:[3, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.40329580698758055, 0.40329580698758055, 0.40329580698758055]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.40784975961208297, 0.40784975961208297, 0.40784975961208297]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.42248786783764863, 0.42248786783764863, 0.42248786783764863]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.45125372853564832, 0.47061470490406576, 0.48997568127248325]\n",
"Treated, Control:[1, 6]\n",
"[-0.90091385 -inf -0.5976143 -0.9258201 inf -0.5976143\n",
" 0.84515425 3.65730015 9.01593128 1.48807399 2.15215931 -0.80184276\n",
" -0.88576083]\n",
"[ 4.08929188e-01 0.00000000e+00 5.76131726e-01 3.97026879e-01\n",
" 0.00000000e+00 5.76131726e-01 4.36588061e-01 1.46361325e-02\n",
" 2.80314817e-04 1.96895741e-01 8.40153585e-02 4.59040056e-01\n",
" 4.16306994e-01]\n",
"[ True False True True False True True False False False False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.4738960879582586, 0.48189496276876853, 0.48989383757927846]\n",
"Treated, Control:[1, 3]\n",
"[ -0.71428571 -inf -0.5 -0.75592895 inf -0.5\n",
" 0.5 3.54131514 10.88635724 1.77491468 3.9821995\n",
" -0.67543936 -0.7324933 ]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ 0.54916518 0. 0.66666667 0.52859548 0. 0.66666667\n",
" 0.66666667 0.07131434 0.00833259 0.2179036 0.05765992 0.5690242\n",
" 0.54008005]\n",
"[ True False True True False True True False False True False True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.4738960879582586, 0.47749355763588774, 0.48109102731351683]\n",
"Treated, Control:[1, 1]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.5016308953196903, 0.54695332747680103, 0.59227575963391166]\n",
"Treated, Control:[14, 6]\n",
"[-0.3790326 -1.10306835 -0.62385029 0.70640633 -0.12970131 -0.62385029\n",
" -0.23180022 -0.57938889 -0.42516792 -0.94043444 -0.43946327 -0.32023597\n",
" 0.60094419]\n",
"[ 0.70909772 0.28452728 0.54055215 0.48897929 0.89824114 0.54055215\n",
" 0.81930797 0.56950783 0.67575372 0.35944515 0.66555642 0.752477\n",
" 0.55536979]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[-0.3790326 -1.10306835 -0.62385029 0.70640633 -0.12970131 -0.62385029\n",
" -0.23180022 -0.57938889 -0.42516792 -0.94043444 -0.43946327 -0.32023597\n",
" 0.60094419]\n",
"[ 0.70909772 0.28452728 0.54055215 0.48897929 0.89824114 0.54055215\n",
" 0.81930797 0.56950783 0.67575372 0.35944515 0.66555642 0.752477\n",
" 0.55536979]\n",
"stratum min, half, max: [0.60380421246484461, 0.70112359871626961, 0.79844298496769472]\n",
"Treated, Control:[22, 13]\n",
"[ 0.94292877 1.09404882 1.58222889 1.32011352 -1.09404882 0.79328259\n",
" -0.06272189 -0.14247967 0.61079884 -0.05508812 -0.52621773 1.0587684\n",
" 1.13380724]\n",
"[ 0.3525698 0.28185533 0.1231356 0.19588123 0.28185533 0.4332802\n",
" 0.95036634 0.88756751 0.5455171 0.95640043 0.60225595 0.29739397\n",
" 0.26504519]\n",
"[ True True False False True True True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.60380421246484461, 0.64780385036124022, 0.69180348825763593]\n",
"Treated, Control:[14, 8]\n",
"[-0.12147143 0.40251236 0.50112881 1.11229559 -0.40251236 -0.40251236\n",
" 0.07987231 0.73084673 0.90720718 1.04919209 1.02171131 -0.0314994\n",
" 0.92106683]\n",
"[ 0.90452982 0.69157674 0.62175137 0.27920281 0.69157674 0.69157674\n",
" 0.93713263 0.47334859 0.37509876 0.3066035 0.31911804 0.9751835\n",
" 0.36799305]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[-0.12147143 0.40251236 0.50112881 1.11229559 -0.40251236 -0.40251236\n",
" 0.07987231 0.73084673 0.90720718 1.04919209 1.02171131 -0.0314994\n",
" 0.92106683]\n",
"[ 0.90452982 0.69157674 0.62175137 0.27920281 0.69157674 0.69157674\n",
" 0.93713263 0.47334859 0.37509876 0.3066035 0.31911804 0.9751835\n",
" 0.36799305]\n",
"stratum min, half, max: [0.71093499230501633, 0.75274970378657935, 0.79456441526814248]\n",
"Treated, Control:[7, 5]\n",
"[ 1.77383218 1.20761473 2.95803989 1.05106615 -1.20761473 1.86052102\n",
" -0.31008684 -2.74351633 -2.29943313 -1.18248947 -1.22869012 1.68715181\n",
" 1.01284844]\n",
"[ 0.10648821 0.25498115 0.01433611 0.31796435 0.25498115 0.09243591\n",
" 0.76286076 0.0207074 0.04429703 0.26436434 0.24731829 0.12246739\n",
" 0.33501155]\n",
"[False True False True True False True False False True True False\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.71093499230501633, 0.7301940267078354, 0.74945306111065446]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Treated, Control:[2, 4]\n",
"[ 0.39900373 0.66666667 1.15470054 0.51639778 -0.66666667 2.\n",
" -0.51639778 -1.11111111 -1.01435662 -0.48919291 -0.62451445 0.34704479\n",
" 0.51639778]\n",
"[ 0.71027484 0.54146974 0.3125 0.6328125 0.54146974 0.11611652\n",
" 0.6328125 0.32880482 0.36778147 0.65031743 0.56614451 0.74604733\n",
" 0.6328125 ]\n",
"[ True True True True True False True True True True True True\n",
" True]\n",
"False\n",
"stratum min, half, max: [0.71093499230501633, 0.711593707903866, 0.71225242350271567]\n",
"Treated, Control:[1, 1]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.71093499230501633, 0.71093499230501633, 0.71093499230501633]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.73519461925906449, 0.74201975141386445, 0.74884488356866452]\n",
"Treated, Control:[1, 2]\n",
"[-0.57735027 0.57735027 0.57735027 0.57735027 -0.57735027 0.57735027\n",
" -0.57735027 -0.57735027 -0.57735027 -0.57735027 -0.57735027 -0.57735027\n",
" 0.57735027]\n",
"[ 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667\n",
" 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667\n",
" 0.66666667]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[-0.57735027 0.57735027 0.57735027 0.57735027 -0.57735027 0.57735027\n",
" -0.57735027 -0.57735027 -0.57735027 -0.57735027 -0.57735027 -0.57735027\n",
" 0.57735027]\n",
"[ 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667\n",
" 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667 0.66666667\n",
" 0.66666667]\n",
"stratum min, half, max: [0.76759191175341357, 0.78021182025127422, 0.79283172874913488]\n",
"Treated, Control:[4, 1]\n",
"[ 0.34835085 nan inf inf nan 1.34164079\n",
" nan -inf -inf 0.23797472 0.42273932 0.37861581\n",
" inf]\n",
"[ 0.75058879 nan 0. 0. nan 0.2722284\n",
" nan 0. 0. 0.82722836 0.7009571 0.73017896\n",
" 0. ]\n",
"[ True False False False False True False False False True True True\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.76759191175341357, 0.76779550369896987, 0.76799909564452618]\n",
"Treated, Control:[1, 1]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.76759191175341357, 0.76759191175341357, 0.76759191175341357]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.79237560041418376, 0.79237560041418376, 0.79237560041418376]\n",
"Treated, Control:[1, 0]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[ nan nan nan nan nan nan nan nan nan nan nan nan nan]\n",
"[False False False False False False False False False False False False\n",
" False]\n",
"False\n",
"stratum min, half, max: [0.80193318262128765, 0.8884043123044536, 0.97487544198761955]\n",
"Treated, Control:[98, 7]\n",
"[ 0.5212613 -0.60759824 -0.60759824 -0.56346873 0.60759824 0.72677722\n",
" 0.36935598 0.26606461 0.26606461 0.32348669 0.46139082 0.72151228\n",
" -0.49182759]"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"[ 0.60330371 0.54479125 0.54479125 0.57434042 0.54479125 0.46901098\n",
" 0.71262065 0.79072131 0.79072131 0.74698256 0.64549114 0.47222906\n",
" 0.62388778]\n",
"[ True True True True True True True True True True True True\n",
" True]\n",
"True\n",
"eh!\n",
"[ 0.5212613 -0.60759824 -0.60759824 -0.56346873 0.60759824 0.72677722\n",
" 0.36935598 0.26606461 0.26606461 0.32348669 0.46139082 0.72151228\n",
" -0.49182759]\n",
"[ 0.60330371 0.54479125 0.54479125 0.57434042 0.54479125 0.46901098\n",
" 0.71262065 0.79072131 0.79072131 0.74698256 0.64549114 0.47222906\n",
" 0.62388778]\n"
]
},
{
"output_type": "pyout",
"prompt_number": 182,
"text": [
"1"
]
}
],
"prompt_number": 182
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.treatment_effect()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 183,
"text": [
"2354.0033706202653"
]
}
],
"prompt_number": 183
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.matching_algo.strata"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 34,
"text": [
"[array([False, False, False, ..., False, False, False], dtype=bool)]"
]
}
],
"prompt_number": 34
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strat = psm.matching_algo.strata[1]\n",
"treated = psm.covariates[strat][psm.assigment_index[strat] == 1]\n",
"control = psm.covariates[strat][psm.assigment_index[strat] == 0]\n",
"cm = CompareMeans(DescrStatsW(treated.values), DescrStatsW(control.values))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 22
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm.ttest_ind()[1]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 23,
"text": [
"array([ 0.79285372, 0.8796118 , 0.49095968, 0.75732896, 1. ,\n",
" 0.71069971, 0.56538209, 0.49900222])"
]
}
],
"prompt_number": 23
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.covariates[strat][psm.assigment_index[strat] == 1].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 34,
"text": [
"age 34.666668\n",
"educ 10.333333\n",
"black 0.666667\n",
"hispanic 0.000000\n",
"married 0.666667\n",
"nodegree 0.666667\n",
"re74 3901.066650\n",
"re75 2378.894287\n",
"dtype: float32"
]
}
],
"prompt_number": 34
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.covariates[strat][psm.assigment_index[strat] == 0].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 35,
"text": [
"age 32.766666\n",
"educ 10.100000\n",
"black 0.833333\n",
"hispanic 0.033333\n",
"married 0.666667\n",
"nodegree 0.766667\n",
"re74 5542.961426\n",
"re75 4064.867920\n",
"dtype: float32"
]
}
],
"prompt_number": 35
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.treatment_objective_variable[strat][psm.assigment_index[strat] == 0].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 37,
"text": [
"5806.4795"
]
}
],
"prompt_number": 37
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.treatment_objective_variable[strat][psm.assigment_index[strat] == 1].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 38,
"text": [
"2078.7527"
]
}
],
"prompt_number": 38
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.covariates[psm.assigment_index == 0].re75.mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 70,
"text": [
"19063.324"
]
}
],
"prompt_number": 70
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.covariates[psm.matching_algo.strata[1]][psm.assigment_index[psm.matching_algo.strata[1]] == 1]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>age</th>\n",
" <th>educ</th>\n",
" <th>black</th>\n",
" <th>hispanic</th>\n",
" <th>married</th>\n",
" <th>nodegree</th>\n",
" <th>re74</th>\n",
" <th>re75</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>9 </th>\n",
" <td> 33</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 0.000000</td>\n",
" <td> 0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21 </th>\n",
" <td> 41</td>\n",
" <td> 14</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0.000000</td>\n",
" <td> 0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>82 </th>\n",
" <td> 38</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0.000000</td>\n",
" <td> 0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>123</th>\n",
" <td> 27</td>\n",
" <td> 13</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 9381.566406</td>\n",
" <td> 853.722473</td>\n",
" </tr>\n",
" <tr>\n",
" <th>136</th>\n",
" <td> 23</td>\n",
" <td> 8</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 0.000000</td>\n",
" <td> 1713.150024</td>\n",
" </tr>\n",
" <tr>\n",
" <th>144</th>\n",
" <td> 31</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0.000000</td>\n",
" <td> 2611.218018</td>\n",
" </tr>\n",
" <tr>\n",
" <th>154</th>\n",
" <td> 42</td>\n",
" <td> 9</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 0.000000</td>\n",
" <td> 3058.531006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>162</th>\n",
" <td> 24</td>\n",
" <td> 10</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 11703.200195</td>\n",
" <td> 4078.152100</td>\n",
" </tr>\n",
" <tr>\n",
" <th>171</th>\n",
" <td> 26</td>\n",
" <td> 12</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 8408.761719</td>\n",
" <td> 5794.831055</td>\n",
" </tr>\n",
" <tr>\n",
" <th>174</th>\n",
" <td> 26</td>\n",
" <td> 10</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 25929.679688</td>\n",
" <td> 6788.958008</td>\n",
" </tr>\n",
" <tr>\n",
" <th>176</th>\n",
" <td> 22</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 492.230499</td>\n",
" <td> 7055.702148</td>\n",
" </tr>\n",
" <tr>\n",
" <th>178</th>\n",
" <td> 22</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 6759.994141</td>\n",
" <td> 8455.503906</td>\n",
" </tr>\n",
" <tr>\n",
" <th>180</th>\n",
" <td> 33</td>\n",
" <td> 12</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 20279.949219</td>\n",
" <td> 10941.349609</td>\n",
" </tr>\n",
" <tr>\n",
" <th>181</th>\n",
" <td> 25</td>\n",
" <td> 14</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 35040.070312</td>\n",
" <td> 11536.570312</td>\n",
" </tr>\n",
" <tr>\n",
" <th>182</th>\n",
" <td> 35</td>\n",
" <td> 9</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 13602.429688</td>\n",
" <td> 13830.639648</td>\n",
" </tr>\n",
" <tr>\n",
" <th>183</th>\n",
" <td> 35</td>\n",
" <td> 8</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 13732.070312</td>\n",
" <td> 17976.150391</td>\n",
" </tr>\n",
" <tr>\n",
" <th>184</th>\n",
" <td> 33</td>\n",
" <td> 11</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 14660.709961</td>\n",
" <td> 25142.240234</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"output_type": "pyout",
"prompt_number": 84,
"text": [
" age educ black hispanic married nodegree re74 re75\n",
"9 33 12 0 0 1 0 0.000000 0.000000\n",
"21 41 14 0 0 0 0 0.000000 0.000000\n",
"82 38 12 0 0 0 0 0.000000 0.000000\n",
"123 27 13 0 0 1 0 9381.566406 853.722473\n",
"136 23 8 0 0 1 1 0.000000 1713.150024\n",
"144 31 12 0 0 0 0 0.000000 2611.218018\n",
"154 42 9 1 0 1 1 0.000000 3058.531006\n",
"162 24 10 1 0 1 1 11703.200195 4078.152100\n",
"171 26 12 1 0 1 0 8408.761719 5794.831055\n",
"174 26 10 1 0 0 1 25929.679688 6788.958008\n",
"176 22 12 0 1 1 0 492.230499 7055.702148\n",
"178 22 12 0 0 0 0 6759.994141 8455.503906\n",
"180 33 12 1 0 1 0 20279.949219 10941.349609\n",
"181 25 14 1 0 1 0 35040.070312 11536.570312\n",
"182 35 9 1 0 1 1 13602.429688 13830.639648\n",
"183 35 8 1 0 1 1 13732.070312 17976.150391\n",
"184 33 11 1 0 1 1 14660.709961 25142.240234"
]
}
],
"prompt_number": 84
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.covariates[psm.matching_algo.strata[1]][psm.assigment_index[psm.matching_algo.strata[1]] == 0].head()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
"<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>age</th>\n",
" <th>educ</th>\n",
" <th>black</th>\n",
" <th>hispanic</th>\n",
" <th>married</th>\n",
" <th>nodegree</th>\n",
" <th>re74</th>\n",
" <th>re75</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>185</th>\n",
" <td> 47</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>186</th>\n",
" <td> 50</td>\n",
" <td> 12</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>187</th>\n",
" <td> 44</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>189</th>\n",
" <td> 54</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>190</th>\n",
" <td> 55</td>\n",
" <td> 12</td>\n",
" <td> 0</td>\n",
" <td> 1</td>\n",
" <td> 1</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" <td> 0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"output_type": "pyout",
"prompt_number": 85,
"text": [
" age educ black hispanic married nodegree re74 re75\n",
"185 47 12 0 0 0 0 0 0\n",
"186 50 12 1 0 1 0 0 0\n",
"187 44 12 0 0 0 0 0 0\n",
"189 54 12 0 0 1 0 0 0\n",
"190 55 12 0 1 1 0 0 0"
]
}
],
"prompt_number": 85
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.scores[1972]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 28,
"text": [
"0.13600352851757275"
]
}
],
"prompt_number": 28
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"mean(psm.scores[psm.matching_algo.strata[1]])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 96,
"text": [
"0.020918320353451886"
]
}
],
"prompt_number": 96
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[psm.matching_algo.strat_effect(x) for x in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 39,
"text": [
"[3777.501, -3727.7268, -2418.1555, 1411.5684, -3561.0857]"
]
}
],
"prompt_number": 39
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def fit(model):\n",
" common = model.common_support()\n",
" scores = model.scores\n",
" limits = np.linspace(scores[common].min(), scores[common].max(), 5+1)\n",
" strata = []\n",
" min = limits[0]\n",
" for max in limits[1:]:\n",
" strat = ps.StrataMatchingAlgorithm.Stratum(model, (scores >= min) & (scores < max))\n",
" strata.append(strat)\n",
" min = max\n",
" return strata"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 35
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strata = fit(psm)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 43
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[strat.describe() for strat in strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"stratum min, max, half: [0.0008182669657569011, 0.19239888559089374, 0.096608576278325323]\n",
"stratum min, max, half: [0.19319236343101098, 0.37523507399166928, 0.28421371871134016]\n",
"stratum min, max, half: [0.3891135258530542, 0.57404227639757444, 0.48157790112531429]\n",
"stratum min, max, half: [0.58238911575118923, 0.76024485238089523, 0.67131698406604223]\n",
"stratum min, max, half: [0.77102241001301075, 0.95953393934479092, 0.86527817467890089]\n"
]
},
{
"output_type": "pyout",
"prompt_number": 44,
"text": [
"[None, None, None, None, None]"
]
}
],
"prompt_number": 44
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[strat.check_balance() for strat in strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[-0.6922933 2.2411403 -0.48289964 -1.21750012 -0.14767722 -3.00403868\n",
" 0.88225721 -1.51008186 -0.41857371 -2.20867749 -0.55882355]\n",
"[ 0.4888973 0.02521318 0.6292618 0.22367159 0.88262421 0.00272369\n",
" 0.37782789 0.13130586 0.67560832 0.0273999 0.57639436]\n",
"[ True False True True True False True False True False True]\n",
"False\n",
"[-0.49976416 -0.41127643 0.4997815 -0.38625964 0.49196562 0.57996894\n",
" -0.49110269 -0.9500284 -0.78736558 -0.48689223 -0.56695581]\n",
"[ 0.61878648 0.68210866 0.61877433 0.7004595 0.62426133 0.56377158\n",
" 0.62486845 0.34532057 0.43368848 0.62783447 0.57253233]\n",
"[ True True True True True True True True True True True]\n",
"True\n",
"eh!\n",
"[-0.49976416 -0.41127643 0.4997815 -0.38625964 0.49196562 0.57996894\n",
" -0.49110269 -0.9500284 -0.78736558 -0.48689223 -0.56695581]\n",
"[ 0.61878648 0.68210866 0.61877433 0.7004595 0.62426133 0.56377158\n",
" 0.62486845 0.34532057 0.43368848 0.62783447 0.57253233]\n",
"[-3.00389175 -3.29418801 -3.14816314 0.98149506 1.62869014 -2.24341141\n",
" 0.64867979 2.33659754 1.91038204 -0.20845833 -0.71323606]\n",
"[ 0.00482766 0.00222145 0.00329519 0.33289913 0.11209983 0.03111638\n",
" 0.52066216 0.02514284 0.06407484 0.83604608 0.48029796]\n",
"[False False False True False False True False False True True]\n",
"False\n",
"[ 1.83380362 1.55847442 3.09562396 1.27012619 -1.55847442 2.12824147\n",
" -0.45037735 -3.8521669 -2.80776976 -0.51635284 0.06728415]\n",
"[ 7.59983695e-02 1.28957135e-01 4.06307788e-03 2.13197782e-01\n",
" 1.28957135e-01 4.11146682e-02 6.55475041e-01 5.29570042e-04\n",
" 8.42847717e-03 6.09158080e-01 9.46774143e-01]\n",
"[False False False True False False True False False True True]\n",
"False\n",
"[ 2.14931538 0.61948773 2.2426914 -0.66714003 -0.61948773 0.62672396\n",
" 0.11418951 -3.0692308 -3.31921464 -1.98350436 -2.65182558]\n",
"[ 0.03475051 0.53742388 0.02779323 0.50667708 0.53742388 0.53269398\n",
" 0.90938479 0.0029631 0.00138096 0.05087616 0.00971658]\n",
"[False True False True True True True False False False False]\n",
"False\n"
]
},
{
"output_type": "pyout",
"prompt_number": 45,
"text": [
"[False, True, False, False, False]"
]
}
],
"prompt_number": 45
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[(strat.describe(), strat.check_balance()) for strat in strata[0].bisect()]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"stratum min, max, half: [0.0008182669657569011, 0.096037460788022166, 0.048427863876889535]\n",
"[-0.36660518 0.70821907 -0.19421271 0.02186206 -0.80300169 -1.27152111\n",
" -0.51776918 -0.92816717 -0.15326614 -1.14146411 -0.25342631]\n",
"[ 0.71398769 0.47896701 0.84604704 0.98256216 0.42215618 0.20382597\n",
" 0.60472881 0.35353499 0.87821796 0.25393809 0.7999886 ]\n",
"[ True True True True True True True True True True True]\n",
"True\n",
"eh!\n",
"[-0.36660518 0.70821907 -0.19421271 0.02186206 -0.80300169 -1.27152111\n",
" -0.51776918 -0.92816717 -0.15326614 -1.14146411 -0.25342631]\n",
"[ 0.71398769 0.47896701 0.84604704 0.98256216 0.42215618 0.20382597\n",
" 0.60472881 0.35353499 0.87821796 0.25393809 0.7999886 ]\n",
"stratum min, max, half: [0.096881468289015393, 0.19081715082049464, 0.143849309554755]\n",
"[-0.04899448 0.96370654 -1.17057346 -0.63547403 0.08531094 -0.73389715\n",
" 0.59916468 -0.05823589 -0.26255973 0.38912667 -0.35926741]\n",
"[ 0.96107166 0.33871087 0.24597957 0.52731656 0.93227246 0.46561062\n",
" 0.55111429 0.95373669 0.79370778 0.69843511 0.72054194]\n",
"[ True True True True True True True True True True True]\n",
"True\n",
"eh!\n",
"[-0.04899448 0.96370654 -1.17057346 -0.63547403 0.08531094 -0.73389715\n",
" 0.59916468 -0.05823589 -0.26255973 0.38912667 -0.35926741]\n",
"[ 0.96107166 0.33871087 0.24597957 0.52731656 0.93227246 0.46561062\n",
" 0.55111429 0.95373669 0.79370778 0.69843511 0.72054194]\n"
]
},
{
"output_type": "pyout",
"prompt_number": 55,
"text": [
"[(None, True), (None, True)]"
]
}
],
"prompt_number": 55
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strata[0].describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"stratum min, max, half: [0.0008182669657569011, 0.19239888559089374, 0.096608576278325323]\n"
]
}
],
"prompt_number": 41
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[strat.describe() for strat in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"stratum min, half, max: [0.024394669916866403, 0.036377127797898874, 0.048359585678931345]\n",
"Treated, Control:[2, 113]\n",
"stratum min, half, max: [0.049791367460576566, 0.074376564900015416, 0.098961762339454265]\n",
"Treated, Control:[4, 106]\n",
"stratum min, half, max: [0.12738325268192066, 0.13065849480396224, 0.13393373692600383]\n",
"Treated, Control:[4, 7]\n",
"stratum min, half, max: [0.15142045480974389, 0.17323505144111528, 0.1950496480724867]\n",
"Treated, Control:[1, 16]\n",
"stratum min, half, max: [0.20329229347260969, 0.29593119214494001, 0.38857009081727029]\n",
"Treated, Control:[27, 41]\n",
"stratum min, half, max: [0.5016308953196903, 0.54695332747680103, 0.59227575963391166]\n",
"Treated, Control:[14, 6]\n",
"stratum min, half, max: [0.60380421246484461, 0.64780385036124022, 0.69180348825763593]\n",
"Treated, Control:[14, 8]\n",
"stratum min, half, max: [0.73519461925906449, 0.74201975141386445, 0.74884488356866452]\n",
"Treated, Control:[1, 2]\n",
"stratum min, half, max: [0.80193318262128765, 0.8884043123044536, 0.97487544198761955]\n",
"Treated, Control:[98, 7]\n"
]
},
{
"output_type": "pyout",
"prompt_number": 180,
"text": [
"[None, None, None, None, None, None, None, None, None]"
]
}
],
"prompt_number": 180
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[strat.treatment_effect() for strat in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 79,
"text": [
"[-4945.6348, -2879.6348, -810.15723, -3926.3667]"
]
}
],
"prompt_number": 79
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[strat.weight() for strat in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 80,
"text": [
"[13, 9, 22, 3]"
]
}
],
"prompt_number": 80
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.matching_algo.treatment_effect()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 154,
"text": [
"-2922.745064113451"
]
}
],
"prompt_number": 154
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"np.sum([w*strat.treatment_effect() for w, strat in zip(psm.matching_algo.weights(), psm.matching_algo.strata)])/np.sum(psm.matching_algo.weights())"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 94,
"text": [
"-2549.20263671875"
]
}
],
"prompt_number": 94
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"np.sum(psm.matching_algo.weights())"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 90,
"text": [
"47"
]
}
],
"prompt_number": 90
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"basic = psm.matching_algo.basic_strata()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 101
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"basic[-1].describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"stratum min, half, max: [0.80056836968613088, 0.88815843704803266, 0.97574850440993433]\n",
"Treated, Control:[92, 9]\n"
]
}
],
"prompt_number": 102
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"basic[-1].check_balance()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[ 0.66811886 -0.63323779 0.68230978 -0.62585671 0.63323779 0.4427636\n",
" -0.11261787 -2.58865426 -3.07270622 -2.42787611 -3.10492858]\n",
"[ 0.50561241 0.52803851 0.49663644 0.53284917 0.52803851 0.65890265\n",
" 0.91056156 0.01108529 0.00274006 0.01699335 0.00248228]\n",
"[ True True True True True True True False False False False]\n",
"False\n"
]
},
{
"output_type": "pyout",
"prompt_number": 103,
"text": [
"False"
]
}
],
"prompt_number": 103
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"psm.covariates.columns"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 105,
"text": [
"Index([age, black, blacku74, educ, hispanic, married, nodegree, re74, re742, re75, re752], dtype=object)"
]
}
],
"prompt_number": 105
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strat = basic[-1]"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 138
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print psm.covariates[strat.control()].re752.describe()\n",
"plt.hist( psm.covariates[strat.control()].re752)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"count 9\n",
"mean 10862253\n",
"std 32287354\n",
"min 0\n",
"25% 0\n",
"50% 0\n",
"75% 0\n",
"max 96958968\n",
"dtype: float64\n"
]
},
{
"output_type": "pyout",
"prompt_number": 152,
"text": [
"(array([8, 0, 0, 0, 0, 0, 0, 0, 0, 1]),\n",
" array([ 0. , 9695896.8 , 19391793.6 ,\n",
" 29087690.4 , 38783587.2 , 48479484. ,\n",
" 58175380.8 , 67871277.60000001, 77567174.40000001,\n",
" 87263071.2 , 96958968. ]),\n",
" <a list of 10 Patch objects>)"
]
},
{
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAW0AAAEICAYAAACUOKXLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEcxJREFUeJzt3XlsFPX/x/HXyjb5cghSbksNWIiwtLQrNRxyLAJyBSOH\nCQXkRn4Yo6BpomgC5Y+K8Idy/EOIIgqCCZpAFFCLjCLltFwBAti0phwSqpRKOXrN7w/K8S1ldnrN\n8uH7fCSbUnY68/YTeLLOzu76bNu2BQAwwmORHgAA4B7RBgCDEG0AMAjRBgCDEG0AMAjRBgCDhI32\nhx9+qG7duikhIUETJkzQzZs3vZgLAFAFx2jn5uZq9erVysrK0rFjx1RWVqaNGzd6NRsAoBK/051N\nmzZVVFSUrl27pgYNGujatWuKiYnxajYAQCWO0Y6OjtY777yjp556Sg0bNtTQoUM1ePDgO/f7fL56\nHxAAHkU1fTG64+mR7Oxs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5o3b/7A+2vSTVfRPnfunGJjY+983759e507dy7s\nNo9irNysxb0+/fRTjRgxwovRPOf2z8XmzZs1Z84cSY/utf1u1uLMmTP6559/NHDgQCUnJ+vLL7/0\nekxPuFmLWbNm6fjx43ryySeVmJioZcuWeT3mQ6Em3XT1T5vbv2h2peu2H8W/oNX5b9q5c6c+++wz\n7d69ux4nihw3azF37lwtXrxYPp9Ptm0/stf2u1mLkpISZWVlaceOHbp27Zp69+6tXr16qXPnzh5M\n6B03a5Genq6kpCRZlqXs7GwNGTJER44c0eOPP+7BhA+X6nbTVbTdXK9deZuzZ88qJibGze6N4vba\n9aNHj2rWrFnavn274/8emczNWvz+++8aP368pFtPPm3btk1RUVGP3KWjbtYiNjZWLVu2VMOGDdWw\nYUP1799fR44ceeSi7WYtMjMz9f7770uS4uLi1LFjR506dUrJycmezhppNeqmm5PpJSUl9tNPP23n\n5OTYN2/eDPtE5J49ex7ZJ9/crMWff/5px8XF2Xv27InQlN5wsxb3mjp1qv3NN994OKF33KzFyZMn\n7UGDBtmlpaV2UVGRHR8fbx8/fjxCE9cfN2sxb948e+HChbZt2/Zff/1lx8TE2H///Xckxq13OTk5\nrp6IdNtNV4+0H3S99qpVqyRJs2fP1ogRI7R161Z16tRJjRs31po1a2r+z89DzM1aLFq0SJcvX75z\nHjcqKkr79++P5Nj1ws1a/K9wsxZdunTRsGHD1L17dz322GOaNWuWAoFAhCeve27WYv78+Zo2bZoS\nExNVXl6uJUuWKDo6OsKT172UlBT98ssvys/PV2xsrNLS0lRSUiKp5t10fMMoAMDDhU+uAQCDEG0A\nMAjRBoBqcvPy9Nv++OMP9evXT8FgUImJidq2bVutjs05bQCopl27dqlJkyaaPHmyjh075rjt1KlT\n1bt3b82ePVsnT57UiBEjlJOTU+Nj80gbAKqpqpenZ2dna/jw4UpOTlb//v116tQpSbdesn/lyhVJ\nUkFBQa1fv8IjbQCogdzcXI0aNerOI+1BgwZp1apV6tSpk/bt26f58+drx44dKiwsVO/evVVYWKii\noiLt2LFDwWCwxsd99N6hBQA8dvXqVe3Zs0evvPLKnd8rLi6WJL399tuaOXOm5s2bp71792rSpEk6\nfvx4jY9FtAGglsrLy/XEE09U+X7YmZmZSktLkyT16tVLN27cUH5+fo3f5ZFz2gBQS02bNlXHjh21\nadMmSbfeBOr2h5906dJFGRkZkqSTJ0/qxo0btXpbXs5pA0A13fvy9DZt2mjRokUaOHCg5syZowsX\nLqikpEQpKSn64IMPlJ2drRkzZqigoEA+n09Lly7V4MGDa3xsog0ABuH0CAAYhGgDgEGINgAYhGgD\ngEGINgAYhGgDgEH+H8sEFqFWUBx4AAAAAElFTkSuQmCC\n"
}
],
"prompt_number": 152
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print psm.covariates[strat.treated()].re752.describe()\n",
"plt.hist(psm.covariates[strat.treated()].re752)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"count 92.0000\n",
"mean 563896.3125\n",
"std 2543422.7500\n",
"min 0.0000\n",
"25% 0.0000\n",
"50% 0.0000\n",
"75% 0.0000\n",
"max 19350762.0000\n",
"dtype: float64\n"
]
},
{
"output_type": "pyout",
"prompt_number": 153,
"text": [
"(array([87, 1, 0, 1, 1, 1, 0, 0, 0, 1]),\n",
" array([ 0. , 1935076.2, 3870152.4, 5805228.6, 7740304.8,\n",
" 9675381. , 11610457.2, 13545533.4, 15480609.6, 17415685.8,\n",
" 19350762. ]),\n",
" <a list of 10 Patch objects>)"
]
},
{
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEICAYAAABPgw/pAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFgpJREFUeJzt3X9sE/f9x/HXFfiK8SuQiVw6yL6pSl0ISSEUlI2uw9R1\nGExEpkA22oFV2Kg2TRvb/lim/dNIU+ttf6ww1qlaI2TG1oC6KbPaUA0P3DEoUEoo3aB4QqQNzLmN\nmbRQ2gUSf/9oiJ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YJ9c+ueQAv1m96OfP38+\n4z7nzp0bSrPGyuZ8WpalgwcPas6cOVq2bJlOnjw53GUag76ZP/TL3LW3t6utrU01NTUD1ufSP3P6\nUvS6bG+U////cn8cHrTIRTbnZd68eero6NC4ceO0e/duBQIBxePxYajOTPTN/KBf5uby5ctatWqV\nNm/erAkTJtywfbD9c0hX6Nncj/7/9zl37pymTZs2lGaNlc35nDhxosaNGyfpwy+mr169qmQyOax1\nmoK+mT/0y8G7evWqVq5cqa985SsKBAI3bM+lfw4p0LO5H72urk7bt2+XJB06dEiTJ0+WbdtDadZY\n2ZxPx3H6/9U+cuSIUqmUiovN/0W/QqBv5g/9cnBSqZQ2bNigiooKbdq06ab75NI/hzTkku5+9Gee\neUaS9Nhjj2nZsmVqbW3VjBkzNH78eG3btm0oTRotm/P5/PPP65e//KVGjx6tcePGqbm5eYSrvnWt\nWbNGL7/8si5cuKCysjI1Njbq6tWrkuibg5XpXNIvB+fAgQPasWOH7rnnHlVXV0uSnnjiCb399tuS\ncu+fVoqvpgHACMxYBACGINABwBAEOgDkSTY/N3Hdd7/73f6fSrj77rszPriVDcbQASBP9u/frwkT\nJmjdunV64403sv7c1q1bdfz4cT377LNDap8rdADIk5v9RMKZM2e0dOlSzZ8/X5///Od1+vTpGz73\n29/+VmvWrBly+0O6bREA4G7jxo165plnNGPGDB0+fFjf+MY39Kc//al/+1tvvaX29nY98MADQ26L\nQAeAArl8+bJeeeUVrV69un9dd3f3gH2am5u1evXqvPzsBIEOAAXS29uryZMnu/6W+c6dO/X000/n\npT3G0AGgQCZNmqQ77rhDzz//vKQPH/k/ceJE//Y333xTFy9e1Gc+85m8tEegA0CerFmzRgsXLtTp\n06dVVlambdu26Te/+Y2ampo0d+5cVVZWKhKJ9O+/c+fOvHwZeh23LQKAIbhCBwBDEOgAYAgCHQAM\nQaADgCEIdAAwBIEOAIb4P+EbFkZ5C88jAAAAAElFTkSuQmCC\n"
}
],
"prompt_number": 153
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print psm.covariates[strat.index].re752.describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"count 101.000\n",
"mean 1481571.625\n",
"std 9898443.000\n",
"min 0.000\n",
"25% 0.000\n",
"50% 0.000\n",
"75% 0.000\n",
"max 96958968.000\n",
"dtype: float64\n"
]
}
],
"prompt_number": 147
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"diff = psm.covariates[strat.treated()].re752.mean() - psm.covariates[strat.control()].re752.mean()\n",
"diff"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 116,
"text": [
"-3456043.0"
]
}
],
"prompt_number": 116
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sigma2 = (psm.covariates[strat.treated()].re752.var() + psm.covariates[strat.control()].re752.var()) /2\n",
"sigma2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 117,
"text": [
"376284567830528.0"
]
}
],
"prompt_number": 117
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sigma = np.sqrt(2*sigma2/(psm.covariates[strat.index].re752.count()))\n",
"sigma"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 118,
"text": [
"3210789.0372823118"
]
}
],
"prompt_number": 118
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"t = diff/sigma\n",
"t"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 119,
"text": [
"-1.0763843279237295"
]
}
],
"prompt_number": 119
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm = CompareMeans(DescrStatsW(psm.covariates[strat.treated()].re752), DescrStatsW(psm.covariates[strat.control()].re752 ))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 143
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm.confint_diff()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 145,
"text": [
"(-16879563.187059753, -3717151.2386283251)"
]
}
],
"prompt_number": 145
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm.ttest_ind()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 146,
"text": [
"(-3.1049286459769263, 0.0024822828758090929, 99.0)"
]
}
],
"prompt_number": 146
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm._tconfint_generic?"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Object `cm._tconfint_generic` not found.\n"
]
}
],
"prompt_number": 130
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm2 = CompareMeans(DescrStatsW(psm.covariates[strat.treated()]), DescrStatsW(psm.covariates[strat.control()] ))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 141
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm2.ttest_ind()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 142,
"text": [
"(array([ 0.66811886, -0.63323779, 0.68230978, -0.62585671, 0.63323779,\n",
" 0.4427636 , -0.11261787, -2.58865426, -3.07270622, -2.42787611,\n",
" -3.10492858]),\n",
" array([ 0.50561241, 0.52803851, 0.49663644, 0.53284917, 0.52803851,\n",
" 0.65890265, 0.91056156, 0.01108529, 0.00274006, 0.01699335,\n",
" 0.00248228]),\n",
" 99.0)"
]
}
],
"prompt_number": 142
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cm2.ttest_ind()[1] > 0.05"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 135,
"text": [
"array([ True, True, True, True, True, True, True, True, True,\n",
" True, True], dtype=bool)"
]
}
],
"prompt_number": 135
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strat.check_balance()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[ 0.66811886 -0.63323779 0.68230978 -0.62585671 0.63323779 0.4427636\n",
" -0.11261787 -2.58865426 -3.07270622 -2.42787611 -3.10492858]\n",
"[ 0.50561241 0.52803851 0.49663644 0.53284917 0.52803851 0.65890265\n",
" 0.91056156 0.01108529 0.00274006 0.01699335 0.00248228]\n",
"[ True True True True True True True False False False False]\n",
"False\n"
]
},
{
"output_type": "pyout",
"prompt_number": 140,
"text": [
"False"
]
}
],
"prompt_number": 140
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strat.describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"stratum min, half, max: [0.80056836968613088, 0.88815843704803266, 0.97574850440993433]\n",
"Treated, Control:[92, 9]\n"
]
}
],
"prompt_number": 139
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[strat.treatment_effect() for strat in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 155,
"text": [
"[-11578.434, -2520.7012, -1456.3008, -3926.3667, -5384.311]"
]
}
],
"prompt_number": 155
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"plt.hist(strat.ps.treatment_objective_variable[strat.treated()])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 156,
"text": [
"(array([5, 1, 1, 1, 0, 0, 1, 0, 0, 1]),\n",
" array([ 0. , 993.00458984, 1986.00917969, 2979.01376953,\n",
" 3972.01835937, 4965.02294922, 5958.02753906, 6951.03212891,\n",
" 7944.03671875, 8937.04130859, 9930.04589844]),\n",
" <a list of 10 Patch objects>)"
]
},
{
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAXUAAAD9CAYAAABDaefJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADzZJREFUeJzt3XtM1fUfx/HXSfj9mqUUpWBgkxCEAwSYRnOKKEPmEi9p\neSltas7Zaulaa25t1VaAc620+qt1Md2kzX9iTkmdnqxUnGFby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2pqavTss8+qpqZGd9xxh8rLy2/aJlLW\n4vjx43rnnXdUW1ur+vp6NTY2atOmTTdtEylr8U/64rGHFPVIOn69ublZs2fP1sKFCzVz5kxJ1/72\nPX36tCTp1KlTGjp0qKS/r8uJEyeUmJiohIQEnThx4qbzExISwvgoum/fvn2qrKxUUlKS5s+fr927\nd2vhwoURuRaJiYlKTEzU2LFjJUlz5sxRTU2N4uPjI24tDh06pHHjxumee+5RVFSUHnvsMe3fvz8i\n1+K6nviduN7ThIQE/frrr5KuvZg4f/68YmNjA95/SFGPlOPXnXNaunSpvF6vVq5c2XH+9OnTtWHD\nBknShg0bOmI/ffp0VVRUqKmpSX6/X8eOHdPDDz+s+Ph4DR48WNXV1XLOaePGjR3XuVWUlpaqrq5O\nfr9fFRUVmjx5sjZu3BiRaxEfH6/hw4fr6NGjkqRdu3YpIyNDJSUlEbcWaWlpOnDggC5fviznnHbt\n2iWv1xuRa3FdT/xOzJgx42+3tWXLFhUWFgYfINQ3B7Zt2+ZSU1NdcnKyKy0tDfVm+rWvvvrKeTwe\nl52d7XJyclxOTo7bvn27O3v2rCssLHQpKSmuqKjI/fHHHx3XefPNN11ycrIbNWqUq6qq6jj/0KFD\nLjMz0yUnJ7vnn3++Lx5Oj/H5fB1Hv0TqWnz33XduzJgx7sEHH3SzZs1yDQ0NEbsWa9ascV6v12Vm\nZrpFixa5pqamiFmLefPmuWHDhrno6GiXmJjoPvroox597FeuXHGPP/64GzlypMvLy3N+vz/oTAH/\nQS8AwK2F//kIAAwh6gBgCFEHAEOIOgAYQtQBwBCiDgCG/A8Qx15nmmAeuQAAAABJRU5ErkJggg==\n"
}
],
"prompt_number": 156
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"plt.hist(strat.ps.treatment_objective_variable[strat.control()])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 157,
"text": [
"(array([2, 0, 0, 0, 1, 0, 1, 1, 0, 1]),\n",
" array([ 0. , 1680.9140625, 3361.828125 , 5042.7421875,\n",
" 6723.65625 , 8404.5703125, 10085.484375 , 11766.3984375,\n",
" 13447.3125 , 15128.2265625, 16809.140625 ]),\n",
" <a list of 10 Patch objects>)"
]
},
{
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD9CAYAAAC7iRw+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEyBJREFUeJzt3X9sVfX9x/HXNcU/iozabdR5bw21t/QHldtia80Swl2Q\nNBDWoUUGTmiALZUFicvG/G+miRaILA6CYZIohLkBG1lCs9x2zrGri1g60rotY9Hi2nBbtBuUbjKD\nvZT394/KHbXlwtp77+G7z/ORnKTn3E/v53V/vXo851z0mZkJAOCM27wOAADILIofABxD8QOAYyh+\nAHAMxQ8AjqH4AcAxSYs/FovpK1/5iubOnavy8nLt2rVrwnGbN29WUVGRQqGQurq60hIUAJAaWclu\nnDZtml544QVVVFTo4sWLuv/++7V48WKVlpYmxkQiEZ0+fVrd3d06ceKENm7cqPb29rQHBwBMTtI9\n/rvuuksVFRWSpDvuuEOlpaU6e/bsmDEtLS1qaGiQJNXU1GhoaEgDAwNpigsAmKqke/zX6u3tVVdX\nl2pqasZs7+/vV35+fmI9EAior69PeXl5iW0+ny8FUQHAPen4xxVu6uTuxYsXtWLFCu3cuVN33HHH\nDYNNXPR7JfV7sDSroeEJmdmY5Zlnnhm3zeuFTP+/c5GJTKle0uWGe/zxeFz19fV6/PHHtXz58nG3\n+/1+xWKxxHpfX5/8fv8E95Qr6e6pZJ2kHElnPJgXAG5NSff4zUwbNmxQWVmZnnrqqQnH1NXV6cCB\nA5Kk9vZ25eTkjDnMAwC4tSTd43/rrbf06quvat68eaqsrJQkNTc368yZ0T3oxsZGLV26VJFIRMFg\nUNOnT9e+ffvSnzoFwuGw1xHGIdPNuxVzkenmkMl7PkvngaSrk/h8ko5Iqk/3VBPYo4aGP2n//j0e\nzA0Ak+fz+dJyrJ9v7gKAYyh+AHA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OGDSotLdVLL70kSWpsbNTSpUsViUQUDAY1ffp07du3LyPB\nAQCTlJYzB9dobW214uJiCwaDtm3btrTOdebMGQuHw1ZWVmZz5861nTt3mpnZ+fPn7aGHHrKioiJb\nvHixXbhwIfE7zc3NFgwGrbi42H79618ntp88edLKy8stGAza5s2bp5zt8uXLVlFRYcuWLbslMl24\ncMHq6+utpKTESktLrb293fNMzc3NVlZWZuXl5bZ69Wq7dOlSxjOtW7fOZs2aZeXl5Yltqcxw6dIl\nW7lypQWDQaupqbHe3t5J5/re975nJSUlNm/ePHv44YdtaGgoo7kmynTVjh07zOfz2fnz52+JTLt2\n7bKSkhKbO3euff/73/c804kTJ6y6utoqKiqsqqrKOjo6MpoprcV/+fJlKywstJ6eHhseHrZQKGSn\nTp1K23wffPCBdXV1mZnZRx99ZHPmzLFTp07Zli1bbPv27WZmtm3bNnv66afNzOwvf/mLhUIhGx4e\ntp6eHissLLQrV66YmVl1dbWdOHHCzMyWLFlira2tU8r2wx/+0B577DH76le/ambmeaa1a9fayy+/\nbGZm8XjchoaGPM3U09NjBQUFdunSJTMzW7lype3fvz/jmd58803r7Owc8yFNZYYXX3zRNm7caGZm\nhw4dsq9//euTzvXaa6/ZyMiImZk9/fTTGc81USaz0R2w2tpamz17dqL4vcx07Ngxe+ihh2x4eNjM\nzP7+9797nmnhwoXW1tZmZmaRSMTC4XBGM6W1+I8fP261tbWJ9a1bt9rWrVvTOeUYX/va1+w3v/mN\nFRcX24cffmhmo38ciouLzWz0L+u1/xVSW1trb7/9tp09e9ZKSkoS2w8ePGiNjY2TzhGLxWzRokV2\n7NixxB6/l5mGhoasoKBg3HYvM50/f97mzJljg4ODFo/HbdmyZfbaa695kqmnp2fMhzSVGWpra629\nvd3MRv/gfuELX5h0rmv98pe/tG984xsZzzVRphUrVtgf//jHMcXvZaZHH33Ufvvb344b52WmVatW\n2eHDh83M7Gc/+1nGX7u0/ls9/f39ys/PT6wHAgH19/enc8qE3t5edXV1qaamRgMDA4kTznl5eYkv\nmJ09e3bMVUpX8312u9/vn1Lu73znO3r++ed1223/ebq9zNTT06MvfvGLWrdunebPn69vfetb+ve/\n/+1pptzcXH33u9/VPffco7vvvls5OTlavHix56+dlNrX6trPRFZWlmbOnKnBwcEp5ZOkV155RUuX\nLvU819GjRxUIBDRv3rwx273M1N3drTfffFMPPvigwuGwTp486Xmmbdu2Jd7vW7Zs0datWzOaKa3F\nf7PfA0i1ixcvqr6+Xjt37tSMGTPGZcpkrl/96leaNWuWKisrr/t9hkxnunz5sjo7O/Xtb39bnZ2d\nmj59urZt2+Zppvfff18/+tGP1Nvbq7Nnz+rixYt69dVXPc00kVshw2c999xzuv322/XYY495muPj\njz9Wc3OzmpqaEtuu957PpMuXL+vChQtqb2/X888/r5UrV3odSRs2bNCuXbt05swZvfDCC1q/fn1G\n509r8d/M9wBSLR6Pq76+XmvWrNHy5cslje6lffjhh5KkDz74QLNmzZowX19fnwKBgPx+v/r6+sZs\nn+x3E44fP66WlhYVFBRo9erVOnbsmNasWeNppkAgoEAgoOrqaknSihUr1NnZqbvuusuzTCdPntSX\nv/xlff7zn1dWVpYeeeQRvf32255muioVr9XV973f79eZM2ckjRbSP//5T+Xm5k462/79+xWJRPTT\nn/40sc2rXO+//756e3sVCoVUUFCgvr4+3X///RoYGPD0uQoEAnrkkUckSdXV1brtttt07tw5TzN1\ndHTo4YcfljT6+evo6Ejcf0Yy3dQBqkmKx+N27733Wk9Pj33yySdpP7l75coVW7NmjT311FNjtm/Z\nsiVx3Gzr1q3jToJ98skn9re//c3uvffexImUBx54wNrb2+3KlSspOblrZhaNRhPH+L3OtGDBAnv3\n3XfNzOyZZ56xLVu2eJrpnXfesblz59rHH39sV65csbVr19ru3bs9yfTZ47GpzPDiiy/aE088YWaj\nx2lv9uTuRLlaW1utrKzM/vGPf4wZl8lcyc47THRy14tMP/7xj+0HP/iBmZm9++67lp+f73mmyspK\ni0ajZmb2+uuvW1VVVUYzpf1yzkgkYnPmzLHCwkJrbm5O61y///3vzefzWSgUsoqKCquoqLDW1lY7\nf/68LVq0aMLL8Z577jkrLCy04uLixFl2s/9cOlVYWGhPPvlkSvJFo9HEVT1eZ3rnnXesqqpqzKWA\nXmfavn174nLOtWvX2vDwcMYzrVq1yr70pS/ZtGnTLBAI2CuvvJLSDJcuXbJHH300celdT0/PpHK9\n/PLLFgwG7Z577km8169e2ZGpXFcz3X777Ynn6loFBQVjLuf0KtPw8LA9/vjjVl5ebvPnz7ff/e53\nnmS69j31hz/8wR544AELhUL24IMPWmdnZ0Yz+cxugYNwAICMcfb/wAUArqL4AcAxFD8AOIbiBwDH\nUPwA4BiKHwAc83+pDKoqiXrX8QAAAABJRU5ErkJggg==\n"
}
],
"prompt_number": 157
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strat.ps.treatment_objective_variable[strat.control()].describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 158,
"text": [
"count 6.000000\n",
"mean 7983.417969\n",
"std 6920.753906\n",
"min 0.000000\n",
"25% 1861.935425\n",
"50% 8895.914062\n",
"75% 12560.675781\n",
"max 16809.140625\n",
"dtype: float64"
]
}
],
"prompt_number": 158
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"strat.ps.treatment_objective_variable[strat.treated()].describe()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 159,
"text": [
"count 10.000000\n",
"mean 2599.106934\n",
"std 3374.964600\n",
"min 0.000000\n",
"25% 139.860794\n",
"50% 1153.856323\n",
"75% 3293.912964\n",
"max 9930.045898\n",
"dtype: float64"
]
}
],
"prompt_number": 159
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"nsw.re78[psm.treated()].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 163,
"text": [
"6349.1455"
]
}
],
"prompt_number": 163
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[nsw.re78[strat.treated()].mean() for strat in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 164,
"text": [
"[0.0, 5832.0498, 5761.5239, 802.35834, 2599.1069]"
]
}
],
"prompt_number": 164
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[nsw.re78[strat.control()].mean() for strat in psm.matching_algo.strata]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 165,
"text": [
"[11578.434, 8352.751, 7217.8247, 4728.7251, 7983.418]"
]
}
],
"prompt_number": 165
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"nsw.re78[psm.matching_algo.strata[1].treated()]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 172,
"text": [
"22 6408.950195\n",
"114 0.000000\n",
"143 0.000000\n",
"161 7382.548828\n",
"162 0.000000\n",
"164 10976.509766\n",
"167 9558.500977\n",
"168 13228.280273\n",
"174 672.877319\n",
"176 10092.830078\n",
"Name: re78, dtype: float32"
]
}
],
"prompt_number": 172
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"nsw.re78[psm.matching_algo.strata[1].treated()].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 173,
"text": [
"5832.0498"
]
}
],
"prompt_number": 173
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"nsw.re78[psm.matching_algo.strata[1].control()].mean()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 175,
"text": [
"8352.751"
]
}
],
"prompt_number": 175
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment