Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add dtables and make_tables functions. Small corrections in etable. Update of ipynb notebooks. #614

Merged
merged 26 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2772e90
Add make_table (style multindex data frame for great_tables or latex)…
dsliwka Sep 5, 2024
db81bf4
gt and tex output via make_table
dsliwka Sep 5, 2024
1f9bf0e
Correct processing of FixestMulti in etable
dsliwka Sep 6, 2024
9739a51
Add notebook to illustrate table layout functions
dsliwka Sep 6, 2024
d5317c4
Correct bug when no fe in models
dsliwka Sep 6, 2024
8f28a93
Use of etable in replicating-the-effect notebook
dsliwka Sep 6, 2024
bb112c9
Update quickstart notebook
dsliwka Sep 6, 2024
515bc7a
Update table-layout notebook
dsliwka Sep 6, 2024
afa0b74
Move intercept to bottom of regression table in etable
dsliwka Sep 6, 2024
925e9ff
Update notebooks
dsliwka Sep 6, 2024
d173d36
Update pyfixest.md
dsliwka Sep 6, 2024
7061a14
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 15, 2024
926f9a3
Correct auto-linter issues:
dsliwka Sep 17, 2024
6177d17
Add table style example
dsliwka Sep 17, 2024
32a4b86
Merge branch 'add-dtables' of https://github.com/dsliwka/pyfixest int…
dsliwka Sep 17, 2024
b7d6516
Apply ruff corrections
dsliwka Sep 17, 2024
dfe00cd
Try to correct mypy issue
dsliwka Sep 17, 2024
3dab586
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 18, 2024
de7e93c
Merge branch 'master' into add-dtables
s3alfisc Sep 18, 2024
a2783f1
unstack expects tuple, not list
s3alfisc Sep 18, 2024
e3059ea
fix mypy error with multi index
s3alfisc Sep 18, 2024
af3d4a7
update notebooks
s3alfisc Sep 18, 2024
33e5c07
FixestMulti now accepted input -> no error raised
s3alfisc Sep 18, 2024
35ca148
add tests for dtable
s3alfisc Sep 23, 2024
e358a96
more tests
s3alfisc Sep 23, 2024
59a2fc6
Merge remote-tracking branch 'origin/master' into add-dtables
s3alfisc Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions docs/difference-in-differences.ipynb

Large diffs are not rendered by default.

Binary file modified docs/latexdocs/SampleTableDoc.pdf
Binary file not shown.
14 changes: 8 additions & 6 deletions docs/latexdocs/SampleTableDoc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,28 @@ \section{A PyFixest LateX Table}%
\begin{table}[htbp]%
\renewcommand\cellalign{t}
\begin{threeparttable}
\begin{tabular}{lcccccc}
\begin{tabular}{lccccccc}
\toprule
& \multicolumn{3}{c}{Y} & \multicolumn{3}{c}{Y2} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& (1) & (2) & (3) & (4) & (5) & (6) \\
\midrule
\addlinespace
X1 & \makecell{-0.95*** \\ (0.07)} & \makecell{-0.92*** \\ (0.06)} & \makecell{-0.92*** \\ (0.06)} & \makecell{-1.27*** \\ (0.17)} & \makecell{-1.23*** \\ (0.19)} & \makecell{-1.23*** \\ (0.19)} \\
X2 & \makecell{-0.17*** \\ (0.02)} & \makecell{-0.17*** \\ (0.01)} & \makecell{-0.19*** \\ (0.03)} & \makecell{-0.13*** \\ (0.04)} & \makecell{-0.12*** \\ (0.04)} & \makecell{-0.07 \\ (0.10)} \\
X1:X2 & & & \makecell{0.01 \\ (0.02)} & & & \makecell{-0.04 \\ (0.08)} \\
\midrule
f1 & x & x & x & x & x & x \\
\addlinespace
f2 & - & x & x & - & x & x \\
f1 & x & x & x & x & x & x \\
\midrule
$R^2$ & 0.49 & 0.66 & 0.66 & 0.12 & 0.17 & 0.17 \\
S.E. type & by: f1 & by: f1 & by: f1 & by: f1 & by: f1 & by: f1 \\
\addlinespace
Observations & 997 & 997 & 997 & 998 & 998 & 998 \\
S.E. type & by: f1 & by: f1 & by: f1 & by: f1 & by: f1 & by: f1 \\
$R^2$ & 0.49 & 0.66 & 0.66 & 0.12 & 0.17 & 0.17 \\
\bottomrule
\end{tabular}
\footnotesize Significance levels: $*$ p $<$ 0.1, $**$ p $<$ 0.05, $***$ p $<$ 0.01. Format of coefficient cell: Coefficient
(Std. Error)
\footnotesize
\end{threeparttable}%
\end{table}

Expand Down
Binary file modified docs/latexdocs/SampleTableDoc2.pdf
Binary file not shown.
11 changes: 7 additions & 4 deletions docs/latexdocs/SampleTableDoc2.tex
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,26 @@ \section{A PyFixest LateX Table}%
\begin{table}[htbp]%
\renewcommand\cellalign{t}
\begin{threeparttable}
\begin{tabular}{lcccccc}
\begin{tabular}{lccccccc}
\toprule
& \multicolumn{2}{c}{US} & \multicolumn{2}{c}{China} & \multicolumn{2}{c}{EU} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}
& Wage & Wealth & Wage & Wealth & Wage & Wealth \\
& (1) & (2) & (3) & (4) & (5) & (6) \\
\midrule
\addlinespace
Age & \makecell{-0.950*** \\ (0.067)} & \makecell{-1.267*** \\ (0.174)} & \makecell{-0.924*** \\ (0.061)} & \makecell{-1.232*** \\ (0.192)} & \makecell{-0.924*** \\ (0.061)} & \makecell{-1.231*** \\ (0.192)} \\
Years of Schooling & \makecell{-0.174*** \\ (0.018)} & \makecell{-0.131** \\ (0.042)} & \makecell{-0.174*** \\ (0.015)} & \makecell{-0.118** \\ (0.042)} & \makecell{-0.185*** \\ (0.025)} & \makecell{-0.074 \\ (0.104)} \\
Age $\times$ Years of Schooling & & & & & \makecell{0.011 \\ (0.018)} & \makecell{-0.041 \\ (0.081)} \\
\midrule
Industry & x & x & x & x & x & x \\
\addlinespace
Year & - & - & x & x & x & x \\
Industry & x & x & x & x & x & x \\
\midrule
$R^2$ & 0.489 & 0.120 & 0.659 & 0.172 & 0.659 & 0.172 \\
S.E. type & by: f1 & by: f1 & by: f1 & by: f1 & by: f1 & by: f1 \\
\addlinespace
Number of Clusters & 42 & 42 & 42 & 37 & 37 & 37 \\
Observations & 997 & 998 & 997 & 998 & 997 & 998 \\
$R^2$ & 0.489 & 0.120 & 0.659 & 0.172 & 0.659 & 0.172 \\
\bottomrule
\end{tabular}
\footnotesize Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Expand Down
16 changes: 8 additions & 8 deletions docs/marginaleffects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"data": {
"text/html": [
"\n",
" <div id=\"35zazR\"></div>\n",
" <div id=\"nveNih\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
" if(!window.letsPlotCallQueue) {\n",
" window.letsPlotCallQueue = [];\n",
Expand All @@ -34,7 +34,7 @@
" (function() {\n",
" var script = document.createElement(\"script\");\n",
" script.type = \"text/javascript\";\n",
" script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.3.2/js-package/distr/lets-plot.min.js\";\n",
" script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.4.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",
Expand All @@ -47,9 +47,9 @@
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading Lets-Plot JS';\n",
" document.getElementById(\"35zazR\").appendChild(div);\n",
" document.getElementById(\"nveNih\").appendChild(div);\n",
" };\n",
" var e = document.getElementById(\"35zazR\");\n",
" var e = document.getElementById(\"nveNih\");\n",
" e.appendChild(script);\n",
" })()\n",
" </script>\n",
Expand All @@ -63,7 +63,7 @@
"data": {
"text/html": [
"\n",
" <div id=\"45nUzX\"></div>\n",
" <div id=\"NFriGb\"></div>\n",
" <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
" if(!window.letsPlotCallQueue) {\n",
" window.letsPlotCallQueue = [];\n",
Expand All @@ -74,7 +74,7 @@
" (function() {\n",
" var script = document.createElement(\"script\");\n",
" script.type = \"text/javascript\";\n",
" script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.3.2/js-package/distr/lets-plot.min.js\";\n",
" script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v4.4.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",
Expand All @@ -87,9 +87,9 @@
" var div = document.createElement(\"div\");\n",
" div.style.color = 'darkred';\n",
" div.textContent = 'Error loading Lets-Plot JS';\n",
" document.getElementById(\"45nUzX\").appendChild(div);\n",
" document.getElementById(\"NFriGb\").appendChild(div);\n",
" };\n",
" var e = document.getElementById(\"45nUzX\");\n",
" var e = document.getElementById(\"NFriGb\");\n",
" e.appendChild(script);\n",
" })()\n",
" </script>\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/pyfixest.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Nevertheless, for a quick introduction, you can take a look at the [quickstart](
[Dube et al (2023)](https://www.nber.org/papers/w31184)
- **Multiple Hypothesis Corrections** following the Procedure by [Romano and Wolf](https://journals.sagepub.com/doi/pdf/10.1177/1536867X20976314) and **Simultaneous Confidence Intervals** using a **Multiplier Bootstrap**
- The **Causal Cluster Variance Estimator (CCV)** following [Abadie et al.](https://economics.mit.edu/sites/default/files/2022-09/When%20Should%20You%20Adjust%20Standard%20Errors%20for%20Clustering.pdf)

- **Publication-ready tables** with [Great Tables](https://posit-dev.github.io/great-tables/articles/intro.html) or LaTex booktabs

## Installation

Expand Down
6 changes: 3 additions & 3 deletions docs/quarto_example/QuartoExample.quarto_ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"\n",
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\"\n"
],
"id": "78e2a9c8"
"id": "451b75fa"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -66,7 +66,7 @@
" \"f2\": \"Year\"\n",
"}"
],
"id": "c444d358",
"id": "f7c12c13",
"execution_count": null,
"outputs": []
},
Expand All @@ -77,7 +77,7 @@
"# A PyFixest Regression Table\n",
"As @tbl-main shows, LaTex Tables generated by PyFixest can be easily integrated into Quarto document when rendered as pdf.\n"
],
"id": "4fc14b82"
"id": "66c1af0d"
},
{
"cell_type": "code",
Expand Down
1,432 changes: 1,021 additions & 411 deletions docs/quickstart.ipynb

Large diffs are not rendered by default.

Loading
Loading