Estoy usando el comando esttab de Benn Jan para Stata y combinando los resultados con mi borrador de documento LaTeX, usando los útiles consejos proporcionados por Jörg Weber. Quiero incluir algunos resultados no estándar en mi tabla de regresión, pero separarlos con una línea y tal vez asociarlos con un subtítulo. El archivo do en Stata sería algo como esto:
sysuse auto, clear
reg mpg weight length i.foreign, robust
test weight+length=0
estadd scalar f_test=r(F)
estadd scalar ppdiff=r(p)
lincom weight+length
estadd scalar marginal=r(estimate)
est store A
esttab A using auto.tex, replace nonotes nomtitles f ///
label booktabs b(3) alignment(S) eqlabels(none) ///
drop(0.foreign) star(* 0.10 ** 0.05 *** 0.01) stats(marginal f_test ppdiff N r2, ///
fmt(3 3 3 %9.0gc 3) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}") ///
labels(`"Hypothesis test"' `"F-test"' `"p-value"' `"Observations"' `"\(R^{2}\)"'))
Y el código LaTeX relacionado:
\documentclass[12pt,A4,fleqn]{article} % fleqn: align equations left
% Document:
\usepackage{geometry} % Custom margins for single page, etc.
\usepackage{fullpage} % Use the full page
\usepackage{setspace} % Enables custom margins, doublespacing, etc.
\usepackage{pdflscape} % Use: \begin{landscape} ... \end{landscape}
\usepackage{bm}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{datetime}
\usepackage{longtable}
\usepackage{lscape} % To create a table in a landscape environment
\usepackage{rotating} % To use sideways table
\usepackage{rotfloat} % Use H with a sideways table
\usepackage{mathtools}
\usepackage{bibentry}
\usepackage{graphics}
\usepackage{threeparttable}
\usepackage{siunitx}
\usepackage{booktabs,dcolumn}
\usepackage{array}
\usepackage{hyperref}
% Font/text:
\usepackage[latin9]{inputenc} % Font definition and input type
\usepackage[T1]{fontenc} % Font output type
\usepackage{lmodern} % Latin Modern fonts
\usepackage{textcomp} % Supports many additional symbols
\usepackage{amsmath} % Math equations, etc.
\usepackage{amsthm} % Math theorems, etc.
\usepackage{amsfonts} % Math fonts (e.g. script fonts)
\usepackage{amssymb} % Math symbols such as infinity
\DeclareMathOperator*{\Max}{Max} % Better looking max function
\DeclareMathOperator*{\Min}{Min} % Better looking min function
\usepackage{color} % Enables colored text
\definecolor{darkblue}{rgb}{0.0,0.0,0.66} % Custom color: dark blue
\usepackage[hyperfootnotes=false,bookmarksopen]{hyperref} % Enable hyperlinks, expand menu subtree
\hypersetup{ % Custom hyperlink settings
pdffitwindow=false, % true: window fit to page when opened
pdfstartview={XYZ null null 1.00}, % Fits the default zoom of the page to 100%
pdfnewwindow=true, % Links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=darkblue, % Color of internal links
citecolor=darkblue, % Color of links to bibliography
urlcolor=darkblue } % Color of external links
%\usepackage{kpfonts} % for nice fonts
% Images:
\usepackage{graphicx} % Allows more types of images to be included
\usepackage[position=bottom]{subfig} % Enables arrayed images
\usepackage[section]{placeins} % Forces floats to stay in section
\usepackage{float} % Used with restylefloat
\restylefloat{figure} % "H" forces a figure to be "exactly here"
\usepackage[justification=centering]{caption} % Center captions
% Tables/arrays:
\usepackage{booktabs} % Table format - increases table spacing
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}} % Spacing for tables increased
\renewcommand{\arraystretch}{1} % Spaces arrays at 1x
\usepackage{dcolumn} % Align decimals in tables (as option)
%\newcolumntype{.}{D{.}{.}{-1}} % Align decimals e.g. \begin{tabular}{c...}
% Miscellaneous:
\interfootnotelinepenalty=10000 % Footnotes won't break across pages
\usepackage[semicolon]{natbib} % Bibliography and citation formating
\usepackage{datetime} % Custom date format for date field
\newdateformat{mydate}{\monthname[\THEMONTH] \THEYEAR} % Defining month year date format
%\usepackage{tikz} % Timelines and other drawings
%\usetikzlibrary{decorations} % Formating for Tikz
% *****************************************************************
% Estout related things
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}}% Thanks to David Carlisle
\let\estinput=\input% define a new input command so that we can still flatten the document
\newcommand{\estwide}[3]{
\vspace{.75ex}{
\begin{tabular*}
{\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\addlinespace[.75ex]
\end{tabular*}
}
}
\newcommand{\estauto}[3]{
\centering{
\vspace{.75ex}{
\begin{tabular}{l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\addlinespace[.75ex]
\end{tabular}
}
}
}
% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
\newcommand{\figtext}[1]{
\vspace{-0.4ex}
\captionsetup{justification=justified,font=footnotesize}
\caption*{\hspace{6pt}\hangindent=1.5em #1}
}
\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}
\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}
% Add significance note with \starnote
\newcommand{\starnote}{\figtext{* p<0.1, ** p<0.05, *** p<0.01. Clustered standard errors in parentheses.}}
% *****************************************************************
% siunitx
% *****************************************************************
\usepackage{siunitx} % centering in tables
\sisetup{
detect-mode,
tight-spacing = true,
group-digits = false ,
input-signs = ,
input-symbols = ( ) [ ] - + *,
input-open-uncertainty = ,
input-close-uncertainty = ,
table-align-text-post = false
}
% *****************************************************************
% *****************************************************************
% *****************************************************************
% DOCUMENT BEGINS HERE
% *****************************************************************
% *****************************************************************
% *****************************************************************
\begin{document}
\begin{table}[h]
\caption{Auto example}
\estauto{auto}{3}{S[table-format=3.4]}
\starnote
\label{tab2}
\end{table}
\end{document}
¿Cómo puedo en este ejemplo insertar una línea entre, digamos, "valor p" y "Observaciones" (modificando únicamente el archivo do)? Y si quiero insertar algún tipo de identificador para esta parte de la tabla, ¿cómo podría hacerlo? Cualquier sugerencia sera grandemente apreciada.