从R到LaTex的cochrane.orcutt测试

时间:2016-04-19 22:40:25

标签: r latex

您好我尝试将R的cochrane.orcutt测试输出导出到Latex。 我的输出如下:

$Cochrane.Orcutt

Call:
lm(formula = YB ~ XB - 1)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.010742 -0.003844 -0.000546  0.002324  0.037165 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
XB(Intercept)   0.0399230  0.0011903  33.542   <2e-16 ***
XBL(MEDIA, 6)  -0.0004572  0.0008494  -0.538    0.591    
XBL(ENDOG1, 0)  0.0558362  0.0016637  33.562   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.005789 on 230 degrees of freedom  
Multiple R-squared:  0.9911,    Adjusted R-squared:  0.991 
F-statistic:  8540 on 3 and 230 DF,  p-value: < 2.2e-16


$rho
[1] 0.1608004

$number.interaction
[1] 3

如果我尝试使用扫帚的整洁功能,R sais:“此列表未识别出整理方法” 在这种情况下我该怎么办? 日Thnx

2 个答案:

答案 0 :(得分:0)

尝试这样的事情:

library(xtable)
xtable(reg2$Cochrane.Orcutt$coefficients)

% latex table generated in R 3.2.5 by xtable 1.8-2 package
% Wed Apr 20 00:38:57 2016
\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
  \hline
 & Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\ 
  \hline
XB(Intercept) & 0.24 & 0.25 & 0.96 & 0.35 \\ 
  XBprice & -1.19 & 0.69 & -1.74 & 0.10 \\ 
  XBincome & 0.00 & 0.00 & 2.13 & 0.04 \\ 
  XBtemp & 0.00 & 0.00 & 6.66 & 0.00 \\ 
   \hline
\end{tabular}
\end{table}

答案 1 :(得分:0)

我想有一张桌子上有两个我的cochrane.orcatt输出,就像它有两个很好的回归。 ......这样:

% Table created by stargazer v.5.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Wed, Apr 20, 2016 - 09:40:34 AM
\begin{table}[!htbp] \centering 
 \caption{} 
 \label{} 
\begin{tabular}{@{\extracolsep{5pt}}lcc} 
\\[-1.8ex]\hline 
 \hline \\[-1.8ex] 
 & \multicolumn{2}{c}{\textit{Dependent variable:}} \\ 
\cline{2-3} 
\\[-1.8ex] & \multicolumn{2}{c}{ENTR} \\ 
\\[-1.8ex] & (1) & (2)\\ 
\hline \\[-1.8ex] 
 L(MEDIA, 6) & 0.016$^{***}$ &  \\ 
  & (0.001) &  \\ 
  & & \\ 
 L(MEDIA, 12) &  & 0.015$^{***}$ \\ 
  &  & (0.001) \\ 
  & & \\ 
 Constant & 0.045$^{***}$ & 0.047$^{***}$ \\ 
  & (0.002) & (0.002) \\ 
  & & \\ 
\hline \\[-1.8ex] 
Observations & 234 & 228 \\ 
R$^{2}$ & 0.356 & 0.317 \\ 
Adjusted R$^{2}$ & 0.353 & 0.314 \\ 
Residual Std. Error & 0.014 (df = 232) & 0.015 (df = 226) \\ 
F Statistic & 128.004$^{***}$ (df = 1; 232) & 104.713$^{***}$ (df = 1; 226)              \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:}  & \multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05;    $^{***}$p$<$0.01} \\ 
\end{tabular} 
\end{table} 

这一个由观星者reg1和reg2完成正常回归     观星者(reg1,reg2)

如果我做reg3,reg4(reg1和reg2的cochrane回归)     stargazer(reg3 $ Chochrane.orcutt $ coefficients,reg4 $ Chochrane.orcutt $ coefficients) 我得到两个单独的表。 :(