reran all notebooks and fixed a few minor busg

This commit is contained in:
Amit Sharma 2020-01-07 14:55:22 +05:30
Родитель aca5825aa8
Коммит c29f299498
10 изменённых файлов: 1442 добавлений и 1214 удалений

Просмотреть файл

@ -59,22 +59,22 @@
"<table class=\"simpletable\">\n", "<table class=\"simpletable\">\n",
"<caption>IV2SLS Regression Results</caption>\n", "<caption>IV2SLS Regression Results</caption>\n",
"<tr>\n", "<tr>\n",
" <th>Dep. Variable:</th> <td>income</td> <th> R-squared: </th> <td> 0.891</td>\n", " <th>Dep. Variable:</th> <td>income</td> <th> R-squared: </th> <td> 0.899</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Model:</th> <td>IV2SLS</td> <th> Adj. R-squared: </th> <td> 0.891</td>\n", " <th>Model:</th> <td>IV2SLS</td> <th> Adj. R-squared: </th> <td> 0.899</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Method:</th> <td>Two Stage</td> <th> F-statistic: </th> <td> 142.4</td>\n", " <th>Method:</th> <td>Two Stage</td> <th> F-statistic: </th> <td> 160.6</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th></th> <td>Least Squares</td> <th> Prob (F-statistic):</th> <td>8.70e-31</td>\n", " <th></th> <td>Least Squares</td> <th> Prob (F-statistic):</th> <td>3.05e-34</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Date:</th> <td>Fri, 08 Nov 2019</td> <th> </th> <td> </td> \n", " <th>Date:</th> <td>Tue, 07 Jan 2020</td> <th> </th> <td> </td> \n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Time:</th> <td>22:37:01</td> <th> </th> <td> </td> \n", " <th>Time:</th> <td>14:32:06</td> <th> </th> <td> </td> \n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>No. Observations:</th> <td> 1000</td> <th> </th> <td> </td> \n", " <th>No. Observations:</th> <td> 1000</td> <th> </th> <td> </td> \n",
@ -91,24 +91,24 @@
" <td></td> <th>coef</th> <th>std err</th> <th>t</th> <th>P>|t|</th> <th>[0.025</th> <th>0.975]</th> \n", " <td></td> <th>coef</th> <th>std err</th> <th>t</th> <th>P>|t|</th> <th>[0.025</th> <th>0.975]</th> \n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Intercept</th> <td> 8.8927</td> <td> 2.132</td> <td> 4.171</td> <td> 0.000</td> <td> 4.709</td> <td> 13.076</td>\n", " <th>Intercept</th> <td> 8.3670</td> <td> 1.987</td> <td> 4.211</td> <td> 0.000</td> <td> 4.468</td> <td> 12.266</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>education</th> <td> 4.2154</td> <td> 0.353</td> <td> 11.935</td> <td> 0.000</td> <td> 3.522</td> <td> 4.908</td>\n", " <th>education</th> <td> 4.2607</td> <td> 0.336</td> <td> 12.674</td> <td> 0.000</td> <td> 3.601</td> <td> 4.920</td>\n",
"</tr>\n", "</tr>\n",
"</table>\n", "</table>\n",
"<table class=\"simpletable\">\n", "<table class=\"simpletable\">\n",
"<tr>\n", "<tr>\n",
" <th>Omnibus:</th> <td> 0.127</td> <th> Durbin-Watson: </th> <td> 1.972</td>\n", " <th>Omnibus:</th> <td> 0.871</td> <th> Durbin-Watson: </th> <td> 2.058</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Prob(Omnibus):</th> <td> 0.938</td> <th> Jarque-Bera (JB): </th> <td> 0.200</td>\n", " <th>Prob(Omnibus):</th> <td> 0.647</td> <th> Jarque-Bera (JB): </th> <td> 0.953</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Skew:</th> <td> 0.009</td> <th> Prob(JB): </th> <td> 0.905</td>\n", " <th>Skew:</th> <td> 0.059</td> <th> Prob(JB): </th> <td> 0.621</td>\n",
"</tr>\n", "</tr>\n",
"<tr>\n", "<tr>\n",
" <th>Kurtosis:</th> <td> 2.933</td> <th> Cond. No. </th> <td> 14.6</td>\n", " <th>Kurtosis:</th> <td> 2.904</td> <th> Cond. No. </th> <td> 14.3</td>\n",
"</tr>\n", "</tr>\n",
"</table>" "</table>"
], ],
@ -117,25 +117,25 @@
"\"\"\"\n", "\"\"\"\n",
" IV2SLS Regression Results \n", " IV2SLS Regression Results \n",
"==============================================================================\n", "==============================================================================\n",
"Dep. Variable: income R-squared: 0.891\n", "Dep. Variable: income R-squared: 0.899\n",
"Model: IV2SLS Adj. R-squared: 0.891\n", "Model: IV2SLS Adj. R-squared: 0.899\n",
"Method: Two Stage F-statistic: 142.4\n", "Method: Two Stage F-statistic: 160.6\n",
" Least Squares Prob (F-statistic): 8.70e-31\n", " Least Squares Prob (F-statistic): 3.05e-34\n",
"Date: Fri, 08 Nov 2019 \n", "Date: Tue, 07 Jan 2020 \n",
"Time: 22:37:01 \n", "Time: 14:32:06 \n",
"No. Observations: 1000 \n", "No. Observations: 1000 \n",
"Df Residuals: 998 \n", "Df Residuals: 998 \n",
"Df Model: 1 \n", "Df Model: 1 \n",
"==============================================================================\n", "==============================================================================\n",
" coef std err t P>|t| [0.025 0.975]\n", " coef std err t P>|t| [0.025 0.975]\n",
"------------------------------------------------------------------------------\n", "------------------------------------------------------------------------------\n",
"Intercept 8.8927 2.132 4.171 0.000 4.709 13.076\n", "Intercept 8.3670 1.987 4.211 0.000 4.468 12.266\n",
"education 4.2154 0.353 11.935 0.000 3.522 4.908\n", "education 4.2607 0.336 12.674 0.000 3.601 4.920\n",
"==============================================================================\n", "==============================================================================\n",
"Omnibus: 0.127 Durbin-Watson: 1.972\n", "Omnibus: 0.871 Durbin-Watson: 2.058\n",
"Prob(Omnibus): 0.938 Jarque-Bera (JB): 0.200\n", "Prob(Omnibus): 0.647 Jarque-Bera (JB): 0.953\n",
"Skew: 0.009 Prob(JB): 0.905\n", "Skew: 0.059 Prob(JB): 0.621\n",
"Kurtosis: 2.933 Cond. No. 14.6\n", "Kurtosis: 2.904 Cond. No. 14.3\n",
"==============================================================================\n", "==============================================================================\n",
"\"\"\"" "\"\"\""
] ]
@ -163,16 +163,17 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"WARNING:dowhy.causal_model:Causal Graph not provided. DoWhy will construct a graph based on data inputs.\n", "WARNING:dowhy.causal_model:Causal Graph not provided. DoWhy will construct a graph based on data inputs.\n",
"INFO:dowhy.causal_graph:If this is observed data (not from a randomized experiment), there might always be missing confounders. Adding a node named \"Unobserved Confounders\" to reflect this.\n",
"INFO:dowhy.causal_model:Model to find the causal effect of treatment ['education'] on outcome ['income']\n", "INFO:dowhy.causal_model:Model to find the causal effect of treatment ['education'] on outcome ['income']\n",
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['U', 'ability']\n", "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['U', 'ability']\n",
"WARNING:dowhy.causal_identifier:There are unobserved common causes. Causal effect cannot be identified.\n" "WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"WARN: Do you want to continue by ignoring these unobserved confounders? [y/n] y\n" "WARN: Do you want to continue by ignoring any unobserved confounders? (use proceed_when_unidentifiable=True to disable this prompt) [y/n] y\n"
] ]
}, },
{ {
@ -182,17 +183,17 @@
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['voucher']\n", "INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['voucher']\n",
"INFO:dowhy.causal_estimator:INFO: Using Instrumental Variable Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Instrumental Variable Estimator\n",
"INFO:dowhy.causal_estimator:Realized estimand: Wald Estimator\n", "INFO:dowhy.causal_estimator:Realized estimand: Wald Estimator\n",
"Realized estimand type: ate\n", "Realized estimand type: nonparametric-ate\n",
"Estimand expression:\n", "Estimand expression:\n",
" \n", " \n",
"Expectation(Derivative(income, voucher))⋅Expectation(Derivative(education, vou\n", "Expectation(Derivative(income, voucher))⋅Expectation(Derivative(education, vou\n",
"\n", "\n",
" -1\n", " -1\n",
"cher)) \n", "cher)) \n",
"Estimand assumption 1, treatment_effect_homogeneity: Each unit's treatment education isaffected in the same way by common causes of education and income\n", "Estimand assumption 1, As-if-random: If U→→income then ¬(U →→{voucher})\n",
"Estimand assumption 2, As-if-random: If U→→income then ¬(U →→voucher)\n", "Estimand assumption 2, Exclusion: If we remove {voucher}→{education}, then ¬({voucher}→income)\n",
"Estimand assumption 3, Exclusion: If we remove {voucher}→education, then ¬(voucher→income)\n", "Estimand assumption 3, treatment_effect_homogeneity: Each unit's treatment ['education'] is affected in the same way by common causes of ['education'] and income\n",
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome income isaffected in the same way by common causes of education and income\n", "Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome income is affected in the same way by common causes of ['education'] and income\n",
"\n" "\n"
] ]
}, },
@ -203,43 +204,41 @@
"*** Causal Estimate ***\n", "*** Causal Estimate ***\n",
"\n", "\n",
"## Target estimand\n", "## Target estimand\n",
"Estimand type: ate\n", "Estimand type: nonparametric-ate\n",
"### Estimand : 1\n", "### Estimand : 1\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(income, voucher)/Derivative(education, voucher))\n",
"Estimand assumption 1, As-if-random: If U→→income then ¬(U →→voucher)\n",
"Estimand assumption 2, Exclusion: If we remove {voucher}→education, then ¬(voucher→income)\n",
"### Estimand : 2\n",
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"──────────(Expectation(income|ability))\n", "────────────(Expectation(income|ability))\n",
"deducation \n", "d[education] \n",
"Estimand assumption 1, Unconfoundedness: If U→education and U→income then P(income|education,ability,U) = P(income|education,ability)\n", "Estimand assumption 1, Unconfoundedness: If U→{education} and U→income then P(income|education,ability,U) = P(income|education,ability)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"Estimand expression:\n",
"Expectation(Derivative(income, [voucher])*Derivative([education], [voucher])**\n",
"(-1))\n",
"Estimand assumption 1, As-if-random: If U→→income then ¬(U →→{voucher})\n",
"Estimand assumption 2, Exclusion: If we remove {voucher}→{education}, then ¬({voucher}→income)\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"Realized estimand: Wald Estimator\n", "Realized estimand: Wald Estimator\n",
"Realized estimand type: ate\n", "Realized estimand type: nonparametric-ate\n",
"Estimand expression:\n", "Estimand expression:\n",
" \n", " \n",
"Expectation(Derivative(income, voucher))⋅Expectation(Derivative(education, vou\n", "Expectation(Derivative(income, voucher))⋅Expectation(Derivative(education, vou\n",
"\n", "\n",
" -1\n", " -1\n",
"cher)) \n", "cher)) \n",
"Estimand assumption 1, treatment_effect_homogeneity: Each unit's treatment education isaffected in the same way by common causes of education and income\n", "Estimand assumption 1, As-if-random: If U→→income then ¬(U →→{voucher})\n",
"Estimand assumption 2, As-if-random: If U→→income then ¬(U →→voucher)\n", "Estimand assumption 2, Exclusion: If we remove {voucher}→{education}, then ¬({voucher}→income)\n",
"Estimand assumption 3, Exclusion: If we remove {voucher}→education, then ¬(voucher→income)\n", "Estimand assumption 3, treatment_effect_homogeneity: Each unit's treatment ['education'] is affected in the same way by common causes of ['education'] and income\n",
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome income isaffected in the same way by common causes of education and income\n", "Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome income is affected in the same way by common causes of ['education'] and income\n",
"\n", "\n",
"## Estimate\n", "## Estimate\n",
"Value: 4.215372803795959\n", "Value: 4.2606685045720365\n",
"\n", "\n",
"## Statistical Significance\n", "## Statistical Significance\n",
"p-value: <0.001\n", "p-value: <0.001\n",
"\n",
"## Effect Strength\n",
"Change in outcome attributable to treatment: nan\n",
"\n" "\n"
] ]
} }
@ -278,7 +277,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.2" "version": "3.6.9"
} }
}, },
"nbformat": 4, "nbformat": 4,

Просмотреть файл

@ -104,12 +104,12 @@
"outputs": [ "outputs": [
{ {
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAANMAAAASCAYAAADBs+vIAAAABHNCSVQICAgIfAhkiAAABmFJREFUaIHtmmtsFUUUx38gICoIPlBiRBECWi2KRAVU4BZjP2BI8JHoByIaS0LEBypExSDVRK1KCIgagSgGJH7QBI1RQQSVh6KiEIICovRWYqVaoYhKS4X64Zzlbrcze3dm7/1i7j/ZzL3z+p89O49zzgyUUEIJRcEtwAJgPfAn0Aa8kbLP64AVwD6gBagHVgHjQnXOAKq03o/AYeAgsAG4C+hcAI4APu94LvCa9tsCZIF5wGmW+j4czwJrgL3I++8HtgCzEf1E4aOzrMpievblkc9Fx52AycCXwF/A38BmYIpFLhMmhmSrKhBHIcZ3PrmOY6tWOgTs8CQL4zntYy+wCHgaWAx8q2UBpmi9emA58AwyeJs0/21EeWk4Ari+40CgQeu9A9QAa/X/TswD3UePR4BNyHvXIB/9a237C9AvUt9HZ1ktrzY802Nkc9Xxcq3foPXmA99r3tIYngD9VM5D2AetD0fa8Z1EruOoAAYhHyHjQRbGZG3/OtDNUN419HssMJ6OK0pf4Gft5+aUHAFc33GV1rk3kj9X818pAAdAd0v+U9r+5Ui+j86y+rjAVcc3av09wJmh/G7Ae1p2UwxfJ+Bj4CfgecyD1pcjzfhOIpcVrmRhnAj8BtRh/gAumKlyLCgCR4b4dxyo5bV0HLQ9yZkXp6TgyIfLtP1qhzY2nWVxm0w+Ol6q3FMNZUO1bG1M+/uBY8BoZMc0Ddq0HOD+XfLK1SVhR664HuiD+BXHgBuAcqAZ+Ar4wqGvVk3/LSKHDRWafqQcYRwCNgKVwAjE3ykGxmu6zaGNTWcgE2QicB6yEGwD1gFHDXV9dNxX0z2Gs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z0NR5ZvdORe6Y1yhuF7O4NlGLyscDzWr8CORgHUfTNA+AW4DEkzd6MxNW1OlY1cqaZZujHg3dXNDuCk5TvasekbZYgGabvEf3rEP0PImeQ7T5uEhsD3I/8neglJJxbhxzMhyLniacD/KR+cdEF3O2V9n1xRiPRsWExwC9qfe+Q/nogt+rNyGVbC5IxCSYe4sZtBz4NtLkS+fSvRw7Ah5FdbAlyb9IhQs867XMrdv94cOU3xuhSzKjNROAbRP9WJEx5Bfljqmv/Jht76IWklXcgfmwm/I+uSf3ioouNPsWM5hU1tvXfiSqooIIKKqigggoq+N/iX2Wlomzc4KF+AAAAAElFTkSuQmCC\n",
"text/latex": [ "text/latex": [
"$\\displaystyle 1.626101325694914$" "$\\displaystyle 1.625771192059154$"
], ],
"text/plain": [ "text/plain": [
"1.626101325694914" "1.625771192059154"
] ]
}, },
"execution_count": 4, "execution_count": 4,
@ -267,12 +267,12 @@
"outputs": [ "outputs": [
{ {
"data": { "data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAMYAAAASCAYAAAAANKFkAAAABHNCSVQICAgIfAhkiAAABuVJREFUaIHt2musXVURB/Bf8VYrWPEBcqMSpVeRqxAqKI8IegvSRBBS8RGjIEZbRVHR8PIR442JkfpogKoIATQq0UQsIBCEWjE8FCPaxlYUi7SWpjZaq4JSqbfih1mbs+/ufp57+u38k5Ods2bWmjWzZ601M2szxBBDtMILcQ224HFsxCV4dsdxZmEJfoF/4d+4D2djrwLvu/FEw29XiYy3YDnuwiOJ7zst5nYKbsdm7MBD+D6ObdH3jNycFg9QRlddnpvkX48Hk4x/4m681+BsnOHEJGur8IstuA0n1/TJ0NZmbX2vq+4ZlmIVHk59tmM1PpPGfBKzCh3H8DM8Dzfi9zgKC/AAXoO/1SiWx7V4B/6CH+IxnIRxfBvvyvHOx6KKcY7HCbgFbyzQ1uBwsfA245Ak94yaeS3FhUmPG7ANL8FpGEnzqnLIA7EWT8EzxMK/akAyuupyNi7Hn3EHNuEAnI598QO8V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87tEAKaIwVy7iIcRJ4lFbbG4jpgu+uOAWOQfqzJyQPuj1vxvsOTjQ9ojPhmOwXfEW7p9gsSqh78ThJ99r3j5sF+8KrhZrB5laKJThgHlO+BsEZxYJwbNftF5v0s6ZStiE53Thbu4QZwfnhK72Gpx31R8s5vhYvw+6ewV7uBXxYPrKtThpKldA+qNI5px2afz4EsTXkZqR9W1whRxXtwi+niHWFTmj2BjDz300EMPPfTQQw89jDX+C3WMMnzb7dZiAAAAAElFTkSuQmCC\n",
"text/latex": [ "text/latex": [
"$\\displaystyle 0.97184812764023$" "$\\displaystyle 1.0884335905187326$"
], ],
"text/plain": [ "text/plain": [
"0.97184812764023" "1.0884335905187326"
] ]
}, },
"execution_count": 9, "execution_count": 9,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -86,62 +86,62 @@
" <tr>\n", " <tr>\n",
" <th>0</th>\n", " <th>0</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.983071</td>\n", " <td>0.701982</td>\n",
" <td>0.029604</td>\n", " <td>0.024579</td>\n",
" <td>-1.906000</td>\n", " <td>0.192484</td>\n",
" <td>0.475283</td>\n", " <td>1.453203</td>\n",
" <td>0.421236</td>\n", " <td>1.225925</td>\n",
" <td>-0.122511</td>\n", " <td>-0.475766</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>8.221879</td>\n", " <td>13.572196</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>1</th>\n", " <th>1</th>\n",
" <td>1.0</td>\n", " <td>0.0</td>\n",
" <td>0.944483</td>\n", " <td>0.242941</td>\n",
" <td>-1.167641</td>\n", " <td>1.225778</td>\n",
" <td>-1.361756</td>\n", " <td>-1.566807</td>\n",
" <td>0.998510</td>\n", " <td>1.107805</td>\n",
" <td>2.293422</td>\n", " <td>1.132326</td>\n",
" <td>-0.370670</td>\n", " <td>0.688376</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>10.892375</td>\n", " <td>13.946462</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>2</th>\n", " <th>2</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.003035</td>\n", " <td>0.883972</td>\n",
" <td>-1.887080</td>\n", " <td>-1.777568</td>\n",
" <td>-0.957847</td>\n", " <td>-1.565806</td>\n",
" <td>-0.082439</td>\n", " <td>0.001832</td>\n",
" <td>0.708058</td>\n", " <td>1.759653</td>\n",
" <td>2.471659</td>\n", " <td>0.634530</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>11.262836</td>\n", " <td>11.779975</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>3</th>\n", " <th>3</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.567655</td>\n", " <td>0.918023</td>\n",
" <td>-0.891603</td>\n", " <td>-0.648299</td>\n",
" <td>-0.462353</td>\n", " <td>-0.682472</td>\n",
" <td>1.038120</td>\n", " <td>1.255655</td>\n",
" <td>3.717308</td>\n", " <td>2.117590</td>\n",
" <td>-0.810405</td>\n", " <td>-0.085458</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>16.739542</td>\n", " <td>14.588348</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>4</th>\n", " <th>4</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.053651</td>\n", " <td>0.942274</td>\n",
" <td>1.149667</td>\n", " <td>0.193453</td>\n",
" <td>1.372050</td>\n", " <td>-1.284952</td>\n",
" <td>2.584487</td>\n", " <td>-0.778548</td>\n",
" <td>1.784072</td>\n", " <td>0.330621</td>\n",
" <td>-3.115305</td>\n", " <td>0.350299</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>16.291701</td>\n", " <td>8.194333</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>...</th>\n", " <th>...</th>\n",
@ -158,62 +158,62 @@
" <tr>\n", " <tr>\n",
" <th>9995</th>\n", " <th>9995</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.987532</td>\n", " <td>0.448219</td>\n",
" <td>0.284643</td>\n", " <td>-0.717358</td>\n",
" <td>0.719454</td>\n", " <td>0.742045</td>\n",
" <td>1.153850</td>\n", " <td>1.596378</td>\n",
" <td>0.322207</td>\n", " <td>1.889145</td>\n",
" <td>1.861305</td>\n", " <td>-0.160641</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>20.637618</td>\n", " <td>18.115923</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>9996</th>\n", " <th>9996</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.009339</td>\n", " <td>0.691309</td>\n",
" <td>-0.629750</td>\n", " <td>0.266874</td>\n",
" <td>-0.525098</td>\n", " <td>-1.134911</td>\n",
" <td>0.691312</td>\n", " <td>1.726687</td>\n",
" <td>1.193163</td>\n", " <td>1.382415</td>\n",
" <td>0.292283</td>\n", " <td>-0.406323</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>12.443858</td>\n", " <td>10.776816</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>9997</th>\n", " <th>9997</th>\n",
" <td>1.0</td>\n", " <td>0.0</td>\n",
" <td>0.906533</td>\n", " <td>0.940634</td>\n",
" <td>-0.370604</td>\n", " <td>-1.437683</td>\n",
" <td>0.865469</td>\n", " <td>-1.950858</td>\n",
" <td>0.147147</td>\n", " <td>1.701739</td>\n",
" <td>1.052848</td>\n", " <td>1.891118</td>\n",
" <td>-0.167638</td>\n", " <td>1.325125</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>13.308040</td>\n", " <td>15.831704</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>9998</th>\n", " <th>9998</th>\n",
" <td>1.0</td>\n", " <td>1.0</td>\n",
" <td>0.795088</td>\n", " <td>0.849666</td>\n",
" <td>2.511765</td>\n", " <td>-0.753199</td>\n",
" <td>-1.309091</td>\n", " <td>-0.198880</td>\n",
" <td>2.818345</td>\n", " <td>1.509888</td>\n",
" <td>0.232468</td>\n", " <td>0.106379</td>\n",
" <td>-1.717677</td>\n", " <td>0.683263</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>15.856803</td>\n", " <td>13.269083</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>9999</th>\n", " <th>9999</th>\n",
" <td>0.0</td>\n", " <td>1.0</td>\n",
" <td>0.208091</td>\n", " <td>0.372705</td>\n",
" <td>-0.689741</td>\n", " <td>-0.018488</td>\n",
" <td>-1.461882</td>\n", " <td>-0.358214</td>\n",
" <td>0.348681</td>\n", " <td>-0.040396</td>\n",
" <td>2.577953</td>\n", " <td>2.855035</td>\n",
" <td>0.609399</td>\n", " <td>0.726370</td>\n",
" <td>True</td>\n", " <td>True</td>\n",
" <td>15.391016</td>\n", " <td>21.026073</td>\n",
" </tr>\n", " </tr>\n",
" </tbody>\n", " </tbody>\n",
"</table>\n", "</table>\n",
@ -222,30 +222,30 @@
], ],
"text/plain": [ "text/plain": [
" Z0 Z1 W0 W1 W2 W3 W4 v0 \\\n", " Z0 Z1 W0 W1 W2 W3 W4 v0 \\\n",
"0 1.0 0.983071 0.029604 -1.906000 0.475283 0.421236 -0.122511 True \n", "0 1.0 0.701982 0.024579 0.192484 1.453203 1.225925 -0.475766 True \n",
"1 1.0 0.944483 -1.167641 -1.361756 0.998510 2.293422 -0.370670 True \n", "1 0.0 0.242941 1.225778 -1.566807 1.107805 1.132326 0.688376 True \n",
"2 1.0 0.003035 -1.887080 -0.957847 -0.082439 0.708058 2.471659 True \n", "2 1.0 0.883972 -1.777568 -1.565806 0.001832 1.759653 0.634530 True \n",
"3 1.0 0.567655 -0.891603 -0.462353 1.038120 3.717308 -0.810405 True \n", "3 1.0 0.918023 -0.648299 -0.682472 1.255655 2.117590 -0.085458 True \n",
"4 1.0 0.053651 1.149667 1.372050 2.584487 1.784072 -3.115305 True \n", "4 1.0 0.942274 0.193453 -1.284952 -0.778548 0.330621 0.350299 True \n",
"... ... ... ... ... ... ... ... ... \n", "... ... ... ... ... ... ... ... ... \n",
"9995 1.0 0.987532 0.284643 0.719454 1.153850 0.322207 1.861305 True \n", "9995 1.0 0.448219 -0.717358 0.742045 1.596378 1.889145 -0.160641 True \n",
"9996 1.0 0.009339 -0.629750 -0.525098 0.691312 1.193163 0.292283 True \n", "9996 1.0 0.691309 0.266874 -1.134911 1.726687 1.382415 -0.406323 True \n",
"9997 1.0 0.906533 -0.370604 0.865469 0.147147 1.052848 -0.167638 True \n", "9997 0.0 0.940634 -1.437683 -1.950858 1.701739 1.891118 1.325125 True \n",
"9998 1.0 0.795088 2.511765 -1.309091 2.818345 0.232468 -1.717677 True \n", "9998 1.0 0.849666 -0.753199 -0.198880 1.509888 0.106379 0.683263 True \n",
"9999 0.0 0.208091 -0.689741 -1.461882 0.348681 2.577953 0.609399 True \n", "9999 1.0 0.372705 -0.018488 -0.358214 -0.040396 2.855035 0.726370 True \n",
"\n", "\n",
" y \n", " y \n",
"0 8.221879 \n", "0 13.572196 \n",
"1 10.892375 \n", "1 13.946462 \n",
"2 11.262836 \n", "2 11.779975 \n",
"3 16.739542 \n", "3 14.588348 \n",
"4 16.291701 \n", "4 8.194333 \n",
"... ... \n", "... ... \n",
"9995 20.637618 \n", "9995 18.115923 \n",
"9996 12.443858 \n", "9996 10.776816 \n",
"9997 13.308040 \n", "9997 15.831704 \n",
"9998 15.856803 \n", "9998 13.269083 \n",
"9999 15.391016 \n", "9999 21.026073 \n",
"\n", "\n",
"[10000 rows x 9 columns]" "[10000 rows x 9 columns]"
] ]
@ -359,7 +359,7 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['W3', 'W4', 'Unobserved Confounders', 'W0', 'W1', 'W2']\n", "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['Unobserved Confounders', 'W4', 'W0', 'W1', 'W3', 'W2']\n",
"WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n" "WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n"
] ]
}, },
@ -386,9 +386,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -423,7 +423,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Linear Regression Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Linear Regression Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W3+W4+W0+W1+W2\n" "INFO:dowhy.causal_estimator:b: y~v0+W4+W0+W1+W3+W2\n"
] ]
}, },
{ {
@ -438,9 +438,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -449,14 +449,14 @@
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y~v0+W3+W4+W0+W1+W2\n", "b: y~v0+W4+W0+W1+W3+W2\n",
"## Estimate\n", "## Estimate\n",
"Value: 9.999999999999785\n", "Value: 9.99999999999974\n",
"\n", "\n",
"## Statistical Significance\n", "## Statistical Significance\n",
"p-value: <0.001\n", "p-value: <0.001\n",
"\n", "\n",
"Causal Estimate is 9.999999999999785\n" "Causal Estimate is 9.99999999999974\n"
] ]
} }
], ],
@ -487,8 +487,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W3+W4+W0+W1+W2\n", "INFO:dowhy.causal_estimator:b: y~v0+W4+W0+W1+W3+W2\n",
"/home/amit/.local/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
}, },
@ -504,9 +504,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -515,11 +515,11 @@
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y~v0+W3+W4+W0+W1+W2\n", "b: y~v0+W4+W0+W1+W3+W2\n",
"## Estimate\n", "## Estimate\n",
"Value: 10.230289803487752\n", "Value: 10.064504732274713\n",
"\n", "\n",
"Causal Estimate is 10.230289803487752\n" "Causal Estimate is 10.064504732274713\n"
] ]
} }
], ],
@ -550,11 +550,13 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Matching Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Matching Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W3+W4+W0+W1+W2\n", "INFO:dowhy.causal_estimator:b: y~v0+W4+W0+W1+W3+W2\n",
"/home/amit/.local/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n", " y = column_or_1d(y, warn=True)\n",
"/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:62: FutureWarning: `item` has been deprecated and will be removed in a future version\n", "/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:62: FutureWarning: `item` has been deprecated and will be removed in a future version\n",
" control_outcome = control.iloc[indices[i]][self._outcome_name].item()\n" " control_outcome = control.iloc[indices[i]][self._outcome_name].item()\n",
"/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:77: FutureWarning: `item` has been deprecated and will be removed in a future version\n",
" treated_outcome = treated.iloc[indices[i]][self._outcome_name].item()\n"
] ]
}, },
{ {
@ -569,9 +571,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -580,19 +582,11 @@
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y~v0+W3+W4+W0+W1+W2\n", "b: y~v0+W4+W0+W1+W3+W2\n",
"## Estimate\n", "## Estimate\n",
"Value: 10.155349951692994\n", "Value: 9.856834069883842\n",
"\n", "\n",
"Causal Estimate is 10.155349951692994\n" "Causal Estimate is 9.856834069883842\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:77: FutureWarning: `item` has been deprecated and will be removed in a future version\n",
" treated_outcome = treated.iloc[indices[i]][self._outcome_name].item()\n"
] ]
} }
], ],
@ -626,7 +620,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W3+W4+W0+W1+W2\n" "INFO:dowhy.causal_estimator:b: y~v0+W4+W0+W1+W3+W2\n"
] ]
}, },
{ {
@ -641,9 +635,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -652,18 +646,18 @@
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y~v0+W3+W4+W0+W1+W2\n", "b: y~v0+W4+W0+W1+W3+W2\n",
"## Estimate\n", "## Estimate\n",
"Value: 14.403498787196613\n", "Value: 15.103825856686212\n",
"\n", "\n",
"Causal Estimate is 14.403498787196613\n" "Causal Estimate is 15.103825856686212\n"
] ]
}, },
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"/home/amit/.local/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
} }
@ -722,9 +716,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -744,9 +738,9 @@
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome y is affected in the same way by common causes of ['v0'] and y\n", "Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome y is affected in the same way by common causes of ['v0'] and y\n",
"\n", "\n",
"## Estimate\n", "## Estimate\n",
"Value: 8.234224900721683\n", "Value: 8.431207181421312\n",
"\n", "\n",
"Causal Estimate is 8.234224900721683\n" "Causal Estimate is 8.431207181421312\n"
] ]
} }
], ],
@ -776,7 +770,33 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:Using Regression Discontinuity Estimator\n", "INFO:dowhy.causal_estimator:Using Regression Discontinuity Estimator\n",
"INFO:dowhy.causal_estimator:\n", "INFO:dowhy.causal_estimator:\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" local_rd_variable local_treatment local_outcome\n",
"6 0.597719 True 19.666240\n",
"11 0.426837 True 8.465613\n",
"19 0.539785 True 16.948250\n",
"22 0.431814 True 11.478121\n",
"25 0.411029 True 17.837136\n",
"... ... ... ...\n",
"9977 0.413834 True 32.515201\n",
"9978 0.457739 True 1.210606\n",
"9979 0.594694 True 9.426116\n",
"9986 0.583982 True 17.739097\n",
"9995 0.448219 True 18.115923\n",
"\n",
"[2026 rows x 3 columns]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:dowhy.causal_estimator:INFO: Using Instrumental Variable Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Instrumental Variable Estimator\n",
"INFO:dowhy.causal_estimator:Realized estimand: Wald Estimator\n", "INFO:dowhy.causal_estimator:Realized estimand: Wald Estimator\n",
"Realized estimand type: nonparametric-ate\n", "Realized estimand type: nonparametric-ate\n",
@ -797,20 +817,6 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
" local_rd_variable local_treatment local_outcome\n",
"3 0.567655 True 16.739542\n",
"14 0.401688 True 13.060404\n",
"16 0.507445 True 7.380282\n",
"24 0.568317 True 0.878313\n",
"30 0.527500 True 15.597167\n",
"... ... ... ...\n",
"9965 0.584194 True 18.405543\n",
"9979 0.521058 True 11.131729\n",
"9984 0.556237 True 10.973448\n",
"9987 0.467405 True 22.988249\n",
"9994 0.552816 True 12.807169\n",
"\n",
"[1947 rows x 3 columns]\n",
"*** Causal Estimate ***\n", "*** Causal Estimate ***\n",
"\n", "\n",
"## Target estimand\n", "## Target estimand\n",
@ -819,9 +825,9 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W3,W4,W0,W1,W2))\n", "─────(Expectation(y|W4,W0,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W3,W4,W0,W1,W2,U) = P(y|v0,W3,W4,W0,W1,W2)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W4,W0,W1,W3,W2,U) = P(y|v0,W4,W0,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
@ -844,9 +850,9 @@
"Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome local_outcome is affected in the same way by common causes of ['local_treatment'] and local_outcome\n", "Estimand assumption 4, outcome_effect_homogeneity: Each unit's outcome local_outcome is affected in the same way by common causes of ['local_treatment'] and local_outcome\n",
"\n", "\n",
"## Estimate\n", "## Estimate\n",
"Value: 4.937929360561585\n", "Value: 25.965733858996124\n",
"\n", "\n",
"Causal Estimate is 4.937929360561585\n" "Causal Estimate is 25.965733858996124\n"
] ]
} }
], ],

Просмотреть файл

@ -15,7 +15,7 @@
"source": [ "source": [
"# importing required libraries\n", "# importing required libraries\n",
"import os, sys\n", "import os, sys\n",
"sys.path.append(os.path.abspath(\"../../\"))\n", "sys.path.append(os.path.abspath(\"../../../\"))\n",
"import dowhy\n", "import dowhy\n",
"from dowhy import CausalModel\n", "from dowhy import CausalModel\n",
"import pandas as pd\n", "import pandas as pd\n",
@ -81,7 +81,7 @@
" <tbody>\n", " <tbody>\n",
" <tr>\n", " <tr>\n",
" <th>0</th>\n", " <th>0</th>\n",
" <td>1</td>\n", " <td>True</td>\n",
" <td>5.599916</td>\n", " <td>5.599916</td>\n",
" <td>4.318780</td>\n", " <td>4.318780</td>\n",
" <td>3.268256</td>\n", " <td>3.268256</td>\n",
@ -105,7 +105,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>1</th>\n", " <th>1</th>\n",
" <td>0</td>\n", " <td>False</td>\n",
" <td>6.875856</td>\n", " <td>6.875856</td>\n",
" <td>7.856495</td>\n", " <td>7.856495</td>\n",
" <td>6.636059</td>\n", " <td>6.636059</td>\n",
@ -129,7 +129,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>2</th>\n", " <th>2</th>\n",
" <td>0</td>\n", " <td>False</td>\n",
" <td>2.996273</td>\n", " <td>2.996273</td>\n",
" <td>6.633952</td>\n", " <td>6.633952</td>\n",
" <td>1.570536</td>\n", " <td>1.570536</td>\n",
@ -153,7 +153,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>3</th>\n", " <th>3</th>\n",
" <td>0</td>\n", " <td>False</td>\n",
" <td>1.366206</td>\n", " <td>1.366206</td>\n",
" <td>5.697239</td>\n", " <td>5.697239</td>\n",
" <td>1.244738</td>\n", " <td>1.244738</td>\n",
@ -177,7 +177,7 @@
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>4</th>\n", " <th>4</th>\n",
" <td>0</td>\n", " <td>False</td>\n",
" <td>1.963538</td>\n", " <td>1.963538</td>\n",
" <td>6.202582</td>\n", " <td>6.202582</td>\n",
" <td>1.685048</td>\n", " <td>1.685048</td>\n",
@ -206,18 +206,18 @@
], ],
"text/plain": [ "text/plain": [
" treatment y_factual y_cfactual mu0 mu1 x1 x2 \\\n", " treatment y_factual y_cfactual mu0 mu1 x1 x2 \\\n",
"0 1 5.599916 4.318780 3.268256 6.854457 -0.528603 -0.343455 \n", "0 True 5.599916 4.318780 3.268256 6.854457 -0.528603 -0.343455 \n",
"1 0 6.875856 7.856495 6.636059 7.562718 -1.736945 -1.802002 \n", "1 False 6.875856 7.856495 6.636059 7.562718 -1.736945 -1.802002 \n",
"2 0 2.996273 6.633952 1.570536 6.121617 -0.807451 -0.202946 \n", "2 False 2.996273 6.633952 1.570536 6.121617 -0.807451 -0.202946 \n",
"3 0 1.366206 5.697239 1.244738 5.889125 0.390083 0.596582 \n", "3 False 1.366206 5.697239 1.244738 5.889125 0.390083 0.596582 \n",
"4 0 1.963538 6.202582 1.685048 6.191994 -1.045229 -0.602710 \n", "4 False 1.963538 6.202582 1.685048 6.191994 -1.045229 -0.602710 \n",
"\n", "\n",
" x3 x4 x5 ... x16 x17 x18 x19 x20 x21 x22 x23 \\\n", " x3 x4 x5 ... x16 x17 x18 x19 x20 x21 x22 x23 \\\n",
"0 1.128554 0.161703 -0.316603 ... 1 1 1 1 0 0 0 0 \n", "0 1.128554 0.161703 -0.316603 ... 1 1 1 1 0 0 0 0 \n",
"1 0.383828 2.244320 -0.629189 ... 1 1 1 1 0 0 0 0 \n", "1 0.383828 2.244320 -0.629189 ... 1 1 1 1 0 0 0 0 \n",
"2 -0.360898 -0.879606 0.808706 ... 1 0 1 1 0 0 0 0 \n", "2 -0.360898 -0.879606 0.808706 ... 1 0 1 1 0 0 0 0 \n",
"3 -1.850350 -0.879606 -0.004017 ... 1 0 1 1 0 0 0 0 \n", "3 -1.850350 -0.879606 -0.004017 ... 1 0 1 1 0 0 0 0 \n",
"4 0.011465 0.161703 0.683672 ... 1 1 1 1 0 0 0 0 \n", "4 0.011465 0.161703 0.683672 ... 1 1 1 1 0 0 0 0 \n",
"\n", "\n",
" x24 x25 \n", " x24 x25 \n",
"0 0 0 \n", "0 0 0 \n",
@ -237,10 +237,10 @@
"source": [ "source": [
"data= pd.read_csv(\"https://raw.githubusercontent.com/AMLab-Amsterdam/CEVAE/master/datasets/IHDP/csv/ihdp_npci_1.csv\", header = None)\n", "data= pd.read_csv(\"https://raw.githubusercontent.com/AMLab-Amsterdam/CEVAE/master/datasets/IHDP/csv/ihdp_npci_1.csv\", header = None)\n",
"col = [\"treatment\", \"y_factual\", \"y_cfactual\", \"mu0\", \"mu1\" ,]\n", "col = [\"treatment\", \"y_factual\", \"y_cfactual\", \"mu0\", \"mu1\" ,]\n",
"\n",
"for i in range(1,26):\n", "for i in range(1,26):\n",
" col.append(\"x\"+str(i))\n", " col.append(\"x\"+str(i))\n",
"data.columns = col\n", "data.columns = col\n",
"data = data.astype({\"treatment\":'bool'}, copy=False)\n",
"data.head()" "data.head()"
] ]
}, },
@ -295,15 +295,15 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['', 'x1', 'x7', 'x16', 'x6', 'x19', 'x17', 'x21', 'x14', 'x25', 'x10', 'x9', 'x12', 'x2', 'x5', 'x24', 'x15', 'x3', 'x20', 'x8', 'x23', 'x4', 'x22', 'x18', 'x11', 'x13']\n", "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['', 'x8', 'x13', 'x21', 'x3', 'x14', 'x10', 'x6', 'x1', 'x24', 'x18', 'x15', 'x7', 'x12', 'x9', 'x22', 'x2', 'x17', 'x19', 'x11', 'x16', 'x4', 'x20', 'x25', 'x23', 'x5']\n",
"WARNING:dowhy.causal_identifier:There are unobserved common causes. Causal effect cannot be identified.\n" "WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"WARN: Do you want to continue by ignoring these unobserved confounders? [y/n] y\n" "WARN: Do you want to continue by ignoring any unobserved confounders? (use proceed_when_unidentifiable=True to disable this prompt) [y/n] y\n"
] ]
}, },
{ {
@ -343,7 +343,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Linear Regression Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Linear Regression Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n" "INFO:dowhy.causal_estimator:b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n"
] ]
}, },
{ {
@ -353,31 +353,31 @@
"*** Causal Estimate ***\n", "*** Causal Estimate ***\n",
"\n", "\n",
"## Target estimand\n", "## Target estimand\n",
"Estimand type: ate\n", "Estimand type: nonparametric-ate\n",
"### Estimand : 1\n", "### Estimand : 1\n",
"Estimand name: iv\n",
"No such variable found!\n",
"### Estimand : 2\n",
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"──────────(Expectation(y_factual|x1,x7,x16,x6,x19,x17,x21,x14,x25,x10,x9,x12,x\n", "────────────(Expectation(y_factual|x8,x13,x21,x3,x14,x10,x6,x1,x24,x18,x15,x7,\n",
"dtreatment \n", "d[treatment] \n",
"\n", "\n",
" \n", " \n",
"2,x5,x24,x15,x3,x20,x8,x23,x4,x22,x18,x11,x13))\n", "x12,x9,x22,x2,x17,x19,x11,x16,x4,x20,x25,x23,x5))\n",
" \n", " \n",
"Estimand assumption 1, Unconfoundedness: If U→treatment and U→y_factual then P(y_factual|treatment,x1,x7,x16,x6,x19,x17,x21,x14,x25,x10,x9,x12,x2,x5,x24,x15,x3,x20,x8,x23,x4,x22,x18,x11,x13,U) = P(y_factual|treatment,x1,x7,x16,x6,x19,x17,x21,x14,x25,x10,x9,x12,x2,x5,x24,x15,x3,x20,x8,x23,x4,x22,x18,x11,x13)\n", "Estimand assumption 1, Unconfoundedness: If U→{treatment} and U→y_factual then P(y_factual|treatment,x8,x13,x21,x3,x14,x10,x6,x1,x24,x18,x15,x7,x12,x9,x22,x2,x17,x19,x11,x16,x4,x20,x25,x23,x5,U) = P(y_factual|treatment,x8,x13,x21,x3,x14,x10,x6,x1,x24,x18,x15,x7,x12,x9,x22,x2,x17,x19,x11,x16,x4,x20,x25,x23,x5)\n",
"### Estimand : 2\n",
"Estimand name: iv\n",
"No such variable found!\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n", "b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n",
"## Estimate\n", "## Estimate\n",
"Value: 3.928671750872714\n", "Value: 3.92867175087271\n",
"\n", "\n",
"## Statistical Significance\n", "## Statistical Significance\n",
"p-value: <0.001\n", "p-value: <0.001\n",
"\n", "\n",
"Causal Estimate is 3.928671750872714\n", "Causal Estimate is 3.92867175087271\n",
"ATE 4.021121012430829\n" "ATE 4.021121012430829\n"
] ]
} }
@ -414,14 +414,20 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Matching Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Matching Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n" "INFO:dowhy.causal_estimator:b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n",
"/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:62: FutureWarning: `item` has been deprecated and will be removed in a future version\n",
" control_outcome = control.iloc[indices[i]][self._outcome_name].item()\n",
"/mnt/c/Users/amshar/code/dowhy/dowhy/causal_estimators/propensity_score_matching_estimator.py:77: FutureWarning: `item` has been deprecated and will be removed in a future version\n",
" treated_outcome = treated.iloc[indices[i]][self._outcome_name].item()\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Causal Estimate is 3.7137071218180533\n", "Causal Estimate is 3.9791388232170393\n",
"ATE 4.021121012430829\n" "ATE 4.021121012430829\n"
] ]
} }
@ -445,7 +451,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -453,14 +459,16 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n" "INFO:dowhy.causal_estimator:b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Causal Estimate is 2.9866811987400976\n", "Causal Estimate is 3.4550471588628207\n",
"ATE 4.021121012430829\n" "ATE 4.021121012430829\n"
] ]
} }
@ -484,7 +492,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -492,16 +500,24 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n" "INFO:dowhy.causal_estimator:b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Causal Estimate is 3.3765676293790015\n", "Causal Estimate is 3.409737824406429\n",
"ATE 4.021121012430829\n" "ATE 4.021121012430829\n"
] ]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
]
} }
], ],
"source": [ "source": [
@ -525,7 +541,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -533,7 +549,9 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13+w_random\n" "INFO:dowhy.causal_estimator:b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5+w_random\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
] ]
}, },
{ {
@ -541,8 +559,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Add a Random Common Cause\n", "Refute: Add a Random Common Cause\n",
"Estimated effect:(3.3765676293790015,)\n", "Estimated effect:(3.409737824406429,)\n",
"New effect:(3.406650074447194,)\n", "New effect:(3.4008436132771305,)\n",
"\n" "\n"
] ]
} }
@ -562,7 +580,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -570,7 +588,9 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~placebo+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n" "INFO:dowhy.causal_estimator:b: y_factual~placebo+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
] ]
}, },
{ {
@ -578,8 +598,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Use a Placebo Treatment\n", "Refute: Use a Placebo Treatment\n",
"Estimated effect:(3.3765676293790015,)\n", "Estimated effect:(3.409737824406429,)\n",
"New effect:(-0.16630861858510526,)\n", "New effect:(-0.08870810484238234,)\n",
"\n" "\n"
] ]
} }
@ -599,7 +619,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -607,7 +627,9 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: y_factual~treatment+x1+x7+x16+x6+x19+x17+x21+x14+x25+x10+x9+x12+x2+x5+x24+x15+x3+x20+x8+x23+x4+x22+x18+x11+x13\n" "INFO:dowhy.causal_estimator:b: y_factual~treatment+x8+x13+x21+x3+x14+x10+x6+x1+x24+x18+x15+x7+x12+x9+x22+x2+x17+x19+x11+x16+x4+x20+x25+x23+x5\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
] ]
}, },
{ {
@ -615,8 +637,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Use a subset of data\n", "Refute: Use a subset of data\n",
"Estimated effect:(3.3765676293790015,)\n", "Estimated effect:(3.409737824406429,)\n",
"New effect:(3.392689859662151,)\n", "New effect:(3.4424088676372993,)\n",
"\n" "\n"
] ]
} }
@ -644,7 +666,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.2" "version": "3.6.9"
} }
}, },
"nbformat": 4, "nbformat": 4,

Просмотреть файл

@ -21,7 +21,7 @@
"R[write to console]: Loading required package: MASS\n", "R[write to console]: Loading required package: MASS\n",
"\n", "\n",
"R[write to console]: ## \n", "R[write to console]: ## \n",
"## Matching (Version 4.9-5, Build Date: 2019-03-05)\n", "## Matching (Version 4.9-6, Build Date: 2019-04-07)\n",
"## See http://sekhon.berkeley.edu/matching for additional documentation.\n", "## See http://sekhon.berkeley.edu/matching for additional documentation.\n",
"## Please cite software as:\n", "## Please cite software as:\n",
"## Jasjeet S. Sekhon. 2011. ``Multivariate and Propensity Score Matching\n", "## Jasjeet S. Sekhon. 2011. ``Multivariate and Propensity Score Matching\n",
@ -36,8 +36,7 @@
"data": { "data": {
"text/plain": [ "text/plain": [
"array(['Matching', 'MASS', 'tools', 'stats', 'graphics', 'grDevices',\n", "array(['Matching', 'MASS', 'tools', 'stats', 'graphics', 'grDevices',\n",
" 'utils', 'datasets', 'methods', 'base'],\n", " 'utils', 'datasets', 'methods', 'base'], dtype='<U9')"
" dtype='<U9')"
] ]
}, },
"execution_count": 1, "execution_count": 1,
@ -47,7 +46,7 @@
], ],
"source": [ "source": [
"import os, sys\n", "import os, sys\n",
"sys.path.append(os.path.abspath(\"../../\"))\n", "sys.path.append(os.path.abspath(\"../../../\"))\n",
"\n", "\n",
"import dowhy\n", "import dowhy\n",
"from dowhy import CausalModel\n", "from dowhy import CausalModel\n",
@ -72,7 +71,8 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"%R data(lalonde)\n", "%R data(lalonde)\n",
"%R -o lalonde\n" "%R -o lalonde\n",
"lalonde = lalonde.astype({'treat':'bool'}, copy=False)"
] ]
}, },
{ {
@ -91,17 +91,18 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"WARNING:dowhy.do_why:Causal Graph not provided. DoWhy will construct a graph based on data inputs.\n", "WARNING:dowhy.causal_model:Causal Graph not provided. DoWhy will construct a graph based on data inputs.\n",
"INFO:dowhy.do_why:Model to find the causal effect of treatment ['treat'] on outcome ['re78']\n", "INFO:dowhy.causal_graph:If this is observed data (not from a randomized experiment), there might always be missing confounders. Adding a node named \"Unobserved Confounders\" to reflect this.\n",
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['U', 'age', 'educ', 'black', 'nodegr', 'married', 'hisp']\n", "INFO:dowhy.causal_model:Model to find the causal effect of treatment ['treat'] on outcome ['re78']\n",
"WARNING:dowhy.causal_identifier:There are unobserved common causes. Causal effect cannot be identified.\n" "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['educ', 'nodegr', 'married', 'black', 'U', 'age', 'hisp']\n",
"WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"WARN: Do you want to continue by ignoring these unobserved confounders? [y/n] y\n" "WARN: Do you want to continue by ignoring any unobserved confounders? (use proceed_when_unidentifiable=True to disable this prompt) [y/n] y\n"
] ]
}, },
{ {
@ -110,19 +111,26 @@
"text": [ "text": [
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:[]\n", "INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:[]\n",
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Weighting Estimator\n",
"INFO:dowhy.causal_estimator:b: re78~treat+age+educ+black+nodegr+married+hisp\n" "INFO:dowhy.causal_estimator:b: re78~treat+educ+nodegr+married+black+age+hisp\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Causal Estimate is 1634.98683597\n" "Causal Estimate is 1614.0090222453164\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n"
] ]
} }
], ],
"source": [ "source": [
"\n",
"model=CausalModel(\n", "model=CausalModel(\n",
" data = lalonde,\n", " data = lalonde,\n",
" treatment='treat',\n", " treatment='treat',\n",
@ -151,7 +159,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Causal Estimate is 1634.98683597\n" "Causal Estimate is 1639.7820238870836\n"
] ]
} }
], ],
@ -186,7 +194,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.2" "version": "3.6.9"
} }
}, },
"nbformat": 4, "nbformat": 4,

Просмотреть файл

@ -81,18 +81,18 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
" X0 Z0 Z1 W0 W1 W2 W3 W4 \\\n", " X0 Z0 Z1 W0 W1 W2 W3 W4 \\\n",
"0 2.118645 0.0 0.912699 -0.446284 -0.565086 -1.043903 -1.270271 -1.348304 \n", "0 0.262340 0.0 0.970873 -0.931370 1.534707 0.212227 0.656675 -0.163708 \n",
"1 0.357787 0.0 0.315884 -1.317656 0.781785 1.368303 -0.527188 -0.479494 \n", "1 1.357854 1.0 0.809297 0.418757 -0.368615 0.550052 1.382726 -0.073969 \n",
"2 1.040296 0.0 0.223548 -1.162306 -0.613312 0.582990 1.869045 0.000660 \n", "2 0.319958 0.0 0.483138 1.101497 -0.700813 0.321933 0.356162 0.361954 \n",
"3 0.876964 0.0 0.094835 -1.756902 1.263752 -0.067055 -1.387165 0.156462 \n", "3 0.309237 0.0 0.262257 -0.008878 0.921562 1.102873 1.271079 -2.435455 \n",
"4 0.310006 0.0 0.641936 -2.069108 0.212686 -1.133720 -0.404351 -1.138160 \n", "4 0.404030 0.0 0.179699 2.122864 1.004447 1.222506 0.880357 -1.621326 \n",
"\n", "\n",
" v0 y \n", " v0 y \n",
"0 False -11.825939 \n", "0 True 11.076007 \n",
"1 True 16.421835 \n", "1 True 18.942833 \n",
"2 True 13.601425 \n", "2 True 16.081703 \n",
"3 False 0.322891 \n", "3 False 2.038722 \n",
"4 False -11.489370 \n", "4 True 21.821949 \n",
"digraph { U[label=\"Unobserved Confounders\"]; U->y;v0->y; U->v0;W0-> v0; W1-> v0; W2-> v0; W3-> v0; W4-> v0;Z0-> v0; Z1-> v0;W0-> y; W1-> y; W2-> y; W3-> y; W4-> y;X0-> y;}\n", "digraph { U[label=\"Unobserved Confounders\"]; U->y;v0->y; U->v0;W0-> v0; W1-> v0; W2-> v0; W3-> v0; W4-> v0;Z0-> v0; Z1-> v0;W0-> y; W1-> y; W2-> y; W3-> y; W4-> y;X0-> y;}\n",
"\n", "\n",
"\n", "\n",
@ -221,7 +221,7 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['Unobserved Confounders', 'W1', 'W2', 'W3', 'W0', 'W4']\n", "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['W0', 'Unobserved Confounders', 'W4', 'W1', 'W3', 'W2']\n",
"WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n" "WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n"
] ]
}, },
@ -236,7 +236,7 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['Z0', 'Z1']\n" "INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['Z1', 'Z0']\n"
] ]
}, },
{ {
@ -248,15 +248,15 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W1,W2,W3,W0,W4))\n", "─────(Expectation(y|W0,W4,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W1,W2,W3,W0,W4,U) = P(y|v0,W1,W2,W3,W0,W4)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W0,W4,W1,W3,W2,U) = P(y|v0,W0,W4,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
"Expectation(Derivative(y, [Z0, Z1])*Derivative([v0], [Z0, Z1])**(-1))\n", "Expectation(Derivative(y, [Z1, Z0])*Derivative([v0], [Z1, Z0])**(-1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→{Z0,Z1})\n", "Estimand assumption 1, As-if-random: If U→→y then ¬(U →→{Z1,Z0})\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→{v0}, then ¬({Z1,Z0}→y)\n",
"\n" "\n"
] ]
} }
@ -282,10 +282,10 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['Unobserved Confounders', 'W1', 'W2', 'W3', 'W0', 'W4']\n", "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['W0', 'Unobserved Confounders', 'W4', 'W1', 'W3', 'W2']\n",
"WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n", "WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n",
"INFO:dowhy.causal_identifier:Continuing by ignoring these unobserved confounders because proceed_when_unidentifiable flag is True.\n", "INFO:dowhy.causal_identifier:Continuing by ignoring these unobserved confounders because proceed_when_unidentifiable flag is True.\n",
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['Z0', 'Z1']\n" "INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:['Z1', 'Z0']\n"
] ]
}, },
{ {
@ -297,15 +297,15 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W1,W2,W3,W0,W4))\n", "─────(Expectation(y|W0,W4,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W1,W2,W3,W0,W4,U) = P(y|v0,W1,W2,W3,W0,W4)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W0,W4,W1,W3,W2,U) = P(y|v0,W0,W4,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
"Expectation(Derivative(y, [Z0, Z1])*Derivative([v0], [Z0, Z1])**(-1))\n", "Expectation(Derivative(y, [Z1, Z0])*Derivative([v0], [Z1, Z0])**(-1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→{Z0,Z1})\n", "Estimand assumption 1, As-if-random: If U→→y then ¬(U →→{Z1,Z0})\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→{v0}, then ¬({Z1,Z0}→y)\n",
"\n" "\n"
] ]
} }
@ -332,7 +332,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W1+W2+W3+W0+W4\n", "INFO:dowhy.causal_estimator:b: y~v0+W0+W4+W1+W3+W2\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -349,22 +349,22 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W1,W2,W3,W0,W4))\n", "─────(Expectation(y|W0,W4,W1,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W1,W2,W3,W0,W4,U) = P(y|v0,W1,W2,W3,W0,W4)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W0,W4,W1,W3,W2,U) = P(y|v0,W0,W4,W1,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"Estimand expression:\n", "Estimand expression:\n",
"Expectation(Derivative(y, [Z0, Z1])*Derivative([v0], [Z0, Z1])**(-1))\n", "Expectation(Derivative(y, [Z1, Z0])*Derivative([v0], [Z1, Z0])**(-1))\n",
"Estimand assumption 1, As-if-random: If U→→y then ¬(U →→{Z0,Z1})\n", "Estimand assumption 1, As-if-random: If U→→y then ¬(U →→{Z1,Z0})\n",
"Estimand assumption 2, Exclusion: If we remove {Z0,Z1}→{v0}, then ¬({Z0,Z1}→y)\n", "Estimand assumption 2, Exclusion: If we remove {Z1,Z0}→{v0}, then ¬({Z1,Z0}→y)\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y~v0+W1+W2+W3+W0+W4\n", "b: y~v0+W0+W4+W1+W3+W2\n",
"## Estimate\n", "## Estimate\n",
"Value: 13.222295952727425\n", "Value: 10.646781689585207\n",
"\n", "\n",
"Causal Estimate is 13.222295952727425\n" "Causal Estimate is 10.646781689585207\n"
] ]
} }
], ],
@ -455,7 +455,7 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['U', 'W1', 'W2', 'W3', 'W0', 'W4']\n", "INFO:dowhy.causal_identifier:Common causes of treatment and outcome:['U', 'W0', 'W1', 'W4', 'W3', 'W2']\n",
"WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n", "WARNING:dowhy.causal_identifier:If this is observed data (not from a randomized experiment), there might always be missing confounders. Causal effect cannot be identified perfectly.\n",
"INFO:dowhy.causal_identifier:Continuing by ignoring these unobserved confounders because proceed_when_unidentifiable flag is True.\n", "INFO:dowhy.causal_identifier:Continuing by ignoring these unobserved confounders because proceed_when_unidentifiable flag is True.\n",
"INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:[]\n" "INFO:dowhy.causal_identifier:Instrumental variables for treatment and outcome:[]\n"
@ -483,7 +483,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W1+W2+W3+W0+W4\n", "INFO:dowhy.causal_estimator:b: y~v0+W0+W1+W4+W3+W2\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -500,19 +500,19 @@
"Estimand name: backdoor\n", "Estimand name: backdoor\n",
"Estimand expression:\n", "Estimand expression:\n",
" d \n", " d \n",
"─────(Expectation(y|W1,W2,W3,W0,W4))\n", "─────(Expectation(y|W0,W1,W4,W3,W2))\n",
"d[v₀] \n", "d[v₀] \n",
"Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W1,W2,W3,W0,W4,U) = P(y|v0,W1,W2,W3,W0,W4)\n", "Estimand assumption 1, Unconfoundedness: If U→{v0} and U→y then P(y|v0,W0,W1,W4,W3,W2,U) = P(y|v0,W0,W1,W4,W3,W2)\n",
"### Estimand : 2\n", "### Estimand : 2\n",
"Estimand name: iv\n", "Estimand name: iv\n",
"No such variable found!\n", "No such variable found!\n",
"\n", "\n",
"## Realized estimand\n", "## Realized estimand\n",
"b: y~v0+W1+W2+W3+W0+W4\n", "b: y~v0+W0+W1+W4+W3+W2\n",
"## Estimate\n", "## Estimate\n",
"Value: 13.222295952727425\n", "Value: 10.646781689585207\n",
"\n", "\n",
"Causal Estimate is 13.222295952727425\n" "Causal Estimate is 10.646781689585207\n"
] ]
} }
], ],
@ -549,7 +549,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W1+W2+W3+W0+W4+w_random\n", "INFO:dowhy.causal_estimator:b: y~v0+W0+W1+W4+W3+W2+w_random\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -559,8 +559,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Add a Random Common Cause\n", "Refute: Add a Random Common Cause\n",
"Estimated effect:(13.222295952727425,)\n", "Estimated effect:(10.646781689585207,)\n",
"New effect:(13.217874105607864,)\n", "New effect:(10.644077917244749,)\n",
"\n" "\n"
] ]
} }
@ -587,7 +587,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W1+W2+W3+W0+W4\n", "INFO:dowhy.causal_estimator:b: y~v0+W0+W1+W4+W3+W2\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -597,8 +597,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Add an Unobserved Common Cause\n", "Refute: Add an Unobserved Common Cause\n",
"Estimated effect:(13.222295952727425,)\n", "Estimated effect:(10.646781689585207,)\n",
"New effect:(12.485335887741792,)\n", "New effect:(9.937718916281279,)\n",
"\n" "\n"
] ]
} }
@ -627,7 +627,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~placebo+W1+W2+W3+W0+W4\n", "INFO:dowhy.causal_estimator:b: y~placebo+W0+W1+W4+W3+W2\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -637,8 +637,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Use a Placebo Treatment\n", "Refute: Use a Placebo Treatment\n",
"Estimated effect:(13.222295952727425,)\n", "Estimated effect:(10.646781689585207,)\n",
"New effect:(0.007294829645751021,)\n", "New effect:(-0.01541340253555656,)\n",
"\n" "\n"
] ]
} }
@ -666,7 +666,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W1+W2+W3+W0+W4\n", "INFO:dowhy.causal_estimator:b: y~v0+W0+W1+W4+W3+W2\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -676,8 +676,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Use a subset of data\n", "Refute: Use a subset of data\n",
"Estimated effect:(13.222295952727425,)\n", "Estimated effect:(10.646781689585207,)\n",
"New effect:(13.213529619173043,)\n", "New effect:(10.644229843118644,)\n",
"\n" "\n"
] ]
} }
@ -706,7 +706,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n", "INFO:dowhy.causal_estimator:INFO: Using Propensity Score Stratification Estimator\n",
"INFO:dowhy.causal_estimator:b: y~v0+W1+W2+W3+W0+W4\n", "INFO:dowhy.causal_estimator:b: y~v0+W0+W1+W4+W3+W2\n",
"/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n", "/home/amshar/python-environments/vpy36/lib/python3.6/site-packages/sklearn/utils/validation.py:744: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
" y = column_or_1d(y, warn=True)\n" " y = column_or_1d(y, warn=True)\n"
] ]
@ -716,8 +716,8 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Refute: Use a subset of data\n", "Refute: Use a subset of data\n",
"Estimated effect:(13.222295952727425,)\n", "Estimated effect:(10.646781689585207,)\n",
"New effect:(13.167958123747333,)\n", "New effect:(10.740850048405411,)\n",
"\n" "\n"
] ]
} }

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны