Skip to content

Commit

Permalink
Dev (#225)
Browse files Browse the repository at this point in the history
* update figures

* fix #103 and report unajdusted r squared values in summary

* update lock file

* update the docs

* update index for docs

* update index

* update news.md

* more elegant reindexing

* update readme

* add fixest_multi_context method and fixest_multi_flag method

* first lpdid prototype

* initial lpdid implementation

* add basic tests for lpdid

* tweaks

* more tweaks

* add type hints

* fix failing tests

* add r2 to etable output #227

* formatting

* small improvements towards F-test implementation

* reorganise DID methods, small tweaks to lpdid

* reorg did codebase, rename folder from experimental to did

* more cleanups

* test lpdid against stata

* small fixes, no wald tests

* test wald test against clubSandwich

* try r2u

* formatting

* run r2u via container

* run on windows latest

* fix windows latest

* no r2u

* back to ubuntu

* pass unit tests for tests of linear coefficients

* pass all test except p values for wald tests

* throw error if all variables are collinear #228

* update error message'

'

* add pooled estimate for lpdid

* bump version

* update news, add vignette for DiD estimation

* lint

* delete load_df_het

* add nobs info to lpdid output plus test

* fix did2s vcov spsolve csc warnings

* minor lpdid cleanups

* update docs

* wald test only in pyfixest 0.14.0

* update readme

* formatting
  • Loading branch information
s3alfisc authored Jan 1, 2024
1 parent a681faa commit e1c251e
Show file tree
Hide file tree
Showing 29 changed files with 2,190 additions and 627 deletions.
111 changes: 54 additions & 57 deletions docs/Replicating-the-Effect.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,48 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
"data": {
"text/html": [
"\n",
" <div id=\"Uysbpp\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
" if(!window.letsPlotCallQueue) {\n",
" window.letsPlotCallQueue = [];\n",
" }; \n",
" window.letsPlotCall = function(f) {\n",
" window.letsPlotCallQueue.push(f);\n",
" };\n",
" (function() {\n",
" var script = document.createElement(\"script\");\n",
" script.type = \"text/javascript\";\n",
" script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.0.1/js-package/distr/lets-plot.min.js\";\n",
" script.onload = function() {\n",
" window.letsPlotCall = function(f) {f();};\n",
" window.letsPlotCallQueue.forEach(function(f) {f();});\n",
" window.letsPlotCallQueue = [];\n",
" \n",
" };\n",
" script.onerror = function(event) {\n",
" window.letsPlotCall = function(f) {}; // noop\n",
" window.letsPlotCallQueue = [];\n",
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading Lets-Plot JS';\n",
" document.getElementById(\"Uysbpp\").appendChild(div);\n",
" };\n",
" var e = document.getElementById(\"Uysbpp\");\n",
" e.appendChild(script);\n",
" })()\n",
" </script>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
Expand All @@ -42,68 +74,33 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"###\n",
"\n",
"Estimation: OLS\n",
"Dep. var.: lwg\n",
"Inference: iid\n",
"Observations: 428\n",
"\n",
"| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5 % | 97.5 % |\n",
"|:--------------|-----------:|-------------:|----------:|-----------:|--------:|---------:|\n",
"| Intercept | 1.007 | 0.071 | 14.180 | 0.000 | 0.868 | 1.147 |\n",
"| inc | 0.010 | 0.003 | 2.947 | 0.003 | 0.003 | 0.016 |\n",
"---\n",
"RMSE: 0.715 Adj. R2: 0.015 Adj. R2 Within: 0.015\n",
"###\n",
"\n",
"Estimation: OLS\n",
"Dep. var.: lwg\n",
"Inference: iid\n",
"Observations: 428\n",
"\n",
"| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5 % | 97.5 % |\n",
"|:--------------|-----------:|-------------:|----------:|-----------:|--------:|---------:|\n",
"| Intercept | 0.972 | 0.070 | 13.909 | 0.000 | 0.834 | 1.109 |\n",
"| inc | 0.005 | 0.003 | 1.640 | 0.102 | -0.001 | 0.012 |\n",
"| wc | 0.342 | 0.075 | 4.595 | 0.000 | 0.196 | 0.489 |\n",
"---\n",
"RMSE: 0.698 Adj. R2: 0.06 Adj. R2 Within: 0.06\n",
"###\n",
"\n",
"Estimation: OLS\n",
"Dep. var.: lwg\n",
"Inference: iid\n",
"Observations: 428\n",
"\n",
"| Coefficient | Estimate | Std. Error | t value | Pr(>|t|) | 2.5 % | 97.5 % |\n",
"|:--------------|-----------:|-------------:|----------:|-----------:|--------:|---------:|\n",
"| Intercept | 0.982 | 0.071 | 13.819 | 0.000 | 0.843 | 1.122 |\n",
"| inc | 0.005 | 0.003 | 1.590 | 0.113 | -0.001 | 0.012 |\n",
"| wc | 0.349 | 0.075 | 4.656 | 0.000 | 0.202 | 0.497 |\n",
"| k5 | -0.072 | 0.087 | -0.825 | 0.410 | -0.243 | 0.099 |\n",
"---\n",
"RMSE: 0.697 Adj. R2: 0.059 Adj. R2 Within: 0.059\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\alexa\\AppData\\Local\\Temp\\ipykernel_20008\\3519125210.py:8: SettingWithCopyWarning: \n",
"C:\\Users\\alexa\\AppData\\Local\\Temp\\ipykernel_3680\\3519125210.py:8: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" dt.loc[:, \"earn\"] = dt[\"lwg\"].apply(\"exp\")\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"> \u001b[1;32mc:\\users\\alexa\\appdata\\local\\programs\\python\\python310\\lib\\site-packages\\pyfixest\\model_matrix_fixest.py\u001b[0m(261)\u001b[0;36mmodel_matrix_fixest\u001b[1;34m()\u001b[0m\n",
"\u001b[1;32m 259 \u001b[1;33m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[1;32m 260 \u001b[1;33m \u001b[1;32mimport\u001b[0m \u001b[0mpdb\u001b[0m\u001b[1;33m;\u001b[0m \u001b[0mpdb\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mset_trace\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[1;32m--> 261 \u001b[1;33m \u001b[1;32mif\u001b[0m \u001b[0mfe\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[1;32m 262 \u001b[1;33m \u001b[1;32mif\u001b[0m \u001b[0mdrop_singletons\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0m\u001b[1;32m 263 \u001b[1;33m \u001b[0mdropped_singleton_bool\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdetect_singletons\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfe\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mto_numpy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[0m\n"
]
}
],
"source": [
Expand Down
Loading

0 comments on commit e1c251e

Please sign in to comment.