Hello,
I am running regressions using the reg3 command. I want to ouput the results into LaTeX using esttab.
The following code creates a problem for me:
I want to have both equations side by side in a .tex file. It looks like this:
In LaTeX, it then looks like this:
Compared to the usual esttab output of several separate reg regressions, there is no \multicolumn{1}{c}{...} in the .tex-file that ensures that the content of the column titles with variable names, i.e. "Length (in.)" and "Price", is not in math mode. As you can see, the LaTeX-output is with these variables in math mode.
This leads to problems when I forced to use math mode in variable labels, and, if I were to change these carefulyl, and compatibility issues when I want to esttab normal reg results.
Is there a reason why there is no multicolumn that encloses the variable labels at the top of the columns, and how can I change this?
I am running regressions using the reg3 command. I want to ouput the results into LaTeX using esttab.
The following code creates a problem for me:
Code:
sysuse auto.dta, clear set more off estimates clear eststo: reg3 ( length mpg trunk weight) /// ( price length mpg displacement gear_ratio ) , endog( price mpg length ) exog( trunk weight displacement ) esttab * using reg3mwe.tex, replace alignment(D{.}{.}{-1}) nonumber nogap nomtitle unstack label
Code:
{ \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \begin{tabular}{l*{2}{D{.}{.}{-1}}} \hline\hline &Length (in.) & Price \\ \hline Mileage (mpg) & -0.742 & -1154.8 \\ & (-0.26) & (-0.66) \\ Trunk space (cu. ft.)& 0.790\sym{*} & \\ & (2.14) & \\ Weight (lbs.) & 0.0197 & \\ & (1.23) & \\ Length (in.) & & -205.8 \\ & & (-0.53) \\ Displacement (cu. in.)& & 18.35 \\ & & (1.12) \\ Gear Ratio & & 2823.4 \\ & & (1.03) \\ Constant & 133.3 & 57296.7 \\ & (1.19) & (0.56) \\ \hline Observations & 74 & \\ \hline\hline \multicolumn{3}{l}{\footnotesize \textit{t} statistics in parentheses}\\ \multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\ \end{tabular} }
Compared to the usual esttab output of several separate reg regressions, there is no \multicolumn{1}{c}{...} in the .tex-file that ensures that the content of the column titles with variable names, i.e. "Length (in.)" and "Price", is not in math mode. As you can see, the LaTeX-output is with these variables in math mode.
This leads to problems when I forced to use math mode in variable labels, and, if I were to change these carefulyl, and compatibility issues when I want to esttab normal reg results.
Is there a reason why there is no multicolumn that encloses the variable labels at the top of the columns, and how can I change this?
Comment