我使用此代码绘制表格,但是,有两条线的长度与其他线不一样,这里是表格和代码:
\begin{table}
\centering
\hline
\textbf{Vector Auto regression of order 2} \\
%\textbf{Y\_gap, exchange rate depreciation and Inflation}\\
\begin{tabular}{p{4cm}p{2cm}p{2cm}p{2cm}p{2.5cm}}
\hline
\textbf{Dependent Variable }&&\textbf{Y\_GAP}& & \\
\hline
R-squared =& & 0.6667 & & \\
Q-statistic = && -0.0311 & & \\
Nobs = & & 47 && \\
Nvars = && 7& & \\
Variable & lag & Coefficient & t-statistic& t-probability \\
Y\_GAP & 1 & 0.416480 & 3.016271 & 0.004433 \\
Y\_GAP & 2 & 0.386314 & 2.794974 & 0.007933 \\
MOV\_DEP2 & 1 & -0.027756 & -0.933225 & 0.356303 \\
MOV\_DEP2 & 2 & 0.020908 & 0.600472 & 0.551579 \\
MOV\_INF & 1 & 0.121292 & 0.859526 & 0.395173 \\
MOV\_INF & 2 & -0.325410 & -2.467055 & 0.018002 \\
constant & & 1.232501 & 1.936710 & 0.059867 \\
\hline
\end{tabular}
\textbf{Granger Causality Tests } \\
\hline
\begin{tabular}{p{5cm}p{5cm}p{5cm}}
Variable & F-value & Probability\\
Y\_GAP & 24.147591 & 0.000000 \\
MOV\_DEP2 & 0.473689 & 0.626149 \\
MOV\_INF & 4.725186 & 0.014382 \\
%\hline
\end{tabular}
答案1
您似乎在一个table
环境中有两个(逻辑)表。没问题 - 只需提供单独的\caption
指令和tabular
环境。
此外,我建议您将第一个表格中有关 R 平方统计量的辅助信息等放在表格底部,而不是顶部。还请努力将右侧三列中的数值数据与相应的小数点对齐。在下面的代码中,我使用列S
类型(由包提供siunitx
)来实现此目标。
题外话:所有数字的小数点后都显示六位 [6!] 有什么用处?三位数是否同样有效,甚至更好?
\documentclass{article}
\usepackage{booktabs}
\usepackage[skip=0.5\baselineskip,
font=bf]{caption}
\usepackage[group-digits=false]{siunitx}
\begin{document}
\begin{table}
\centering
\caption{Vector autoregression of order~2. Dep.\ variable: Y\_GAP}
\begin{tabular}{l c *{2}{S[table-format=-1.6]} S[table-format=1.6]}
\toprule
Variable & lag & {Coefficient} & {t-statistic} & {p-value} \\
\midrule
Y\_GAP & 1 & 0.416480 & 3.016271 & 0.004433 \\
Y\_GAP & 2 & 0.386314 & 2.794974 & 0.007933 \\
MOV\_DEP2 & 1 & -0.027756 & -0.933225 & 0.356303 \\
MOV\_DEP2 & 2 & 0.020908 & 0.600472 & 0.551579 \\
MOV\_INF & 1 & 0.121292 & 0.859526 & 0.395173 \\
MOV\_INF & 2 & -0.325410 & -2.467055 & 0.018002 \\
Constant & & 1.232501 & 1.936710 & 0.059867 \\
\addlinespace
%% Provide an inner or "nested" tabular environment for the aux. information
\multicolumn{5}{l}{%
\begin{tabular}{@{}lS[table-format=-1.4]@{}}
R-squared & 0.6667 \\
Q-statistic& -0.0311 \\
Nobs & {47} \\
Nvars & {7} \\
\end{tabular}}\\
\bottomrule
\end{tabular}
\bigskip\bigskip
\caption{Granger Causality Tests}
\begin{tabular}{lS[table-format=2.6]S[table-format=2.6]}
\toprule
Variable & {F-value} & {Probability} \\
\midrule
Y\_GAP & 24.147591 & 0.000000 \\
MOV\_DEP2 & 0.473689 & 0.626149 \\
MOV\_INF & 4.725186 & 0.014382 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}