Closed gregmacfarlane closed 4 years ago
There's no built in function in modelsummary
, but you can export your code as LaTeX using the clean_latex
function. Then, you can use the dcolumn
package and modify a single line of code. This example should bring you pretty close (look at the \begin{longtable}
line.
\documentclass{article}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{dcolumn}
\begin{document}
\begin{longtable}[c]{ld{1}d{1}}
\toprule
& OLS 1 & OLS 2 \\
\midrule\relax
(Intercept) & 64.114 [53.678, 74.550] & 57.331 [40.794, 73.868] \\
Crime\_prop & -0.002 [-0.003, -0.000] & -0.002 [-0.004, -0.001] \\
Infants & -0.001 [-0.001, -0.000] & 0.000 [-0.000, 0.001] \\
\midrule
Num.Obs. & 86 & 86 \\
R2 & 0.237 & 0.073 \\
Adj.R2 & 0.218 & 0.051 \\
AIC & 718.8 & 797.9 \\
BIC & 728.6 & 807.8 \\
Log.Lik. & -355.382 & -394.974 \\
\bottomrule
\end{longtable}
\end{document}
I thought about this a lot, but unfortunately, it would be quite tricky to implement given the current internals. We can already present estimates side by side with confidence intervals, though not in two separate columns. This may not produce optimal outcomes, but a minor tweak with dcolumn can help a lot. I realize that this is not an ideal solution, but it would be a lot of work on my end for a somewhat niche feature.
Sorry!
I have a long table in an article that requires I use horizontal statistics. I also wish to show confidence intervals instead of standard errors. Like this:
Created on 2020-05-12 by the reprex package (v0.3.0)
One of my reviewers has asked that I try to line up the values in the confidence intervals so that the table is easier to read. I imagine that if I were to
separate()
the confidence intervals from the estimates I would be most of the way there. I am trying to avoid just building the table in pure LaTeX. Is there functionality to do this already?