重新排列观星台中的变量

时间:2019-07-02 18:05:28

标签: r stargazer

当我尝试对观星者中的变量重新排序时遇到了一些问题。首先,我定义了一个字符向量,指示我想要的顺序。

> order
[1] "poly(log(fall_t), 2)1"         "poly(log(fall_t), 2)2"         "poly(winter_t, 2)1"            "poly(winter_t, 2)2"           
[5] "poly(log(spring_t), 2)1"       "poly(log(spring_t), 2)2"       "poly(log(fall_p), 2)1"         "poly(log(fall_p), 2)2"        
[9] "poly(log(winter_p), 2)1"       "poly(log(winter_p), 2)2"       "poly(log(spring_p), 2)1"       "poly(log(spring_p), 2)2"      
[13] "log(aot_fall)"                 "log(aot_winter)"               "log(aot_spring)"               "poly(log(aot_fall), 2)1"      
[17] "poly(log(aot_fall), 2)2"       "log(aot_fall):log(fall_t)"     "poly(log(aot_spring), 2)1"     "poly(log(aot_spring), 2)2"    
[21] "log(aot_spring):log(spring_t)" "poly(log(aot_winter), 2)1"     "poly(log(aot_winter), 2)2"     "log(aot_winter):winter" 

然后我打电话给观星人

stargazer(pmclimatevft, pmftsea, pmftqsea, pmftint, title = "Panel data with fixed time effect poly",
          model.names = F, model.numbers = F, object.names = F, dep.var.caption = "Yield", dep.var.labels.include = F,
          column.labels = c("Only climate variables","linear","quartic","Intersection"),
          omit = c("Year"), omit.labels = c("Time fixed effect"),
          order = order,
          dep.var.labels = "Yield", digits = 3, notes = "*Average and square temperature of Winter are not in log form due to negative values.",
          align = T, no.space = T, column.sep.width = "-10pt", omit.stat = "f")

下面是LaTex代码。

\begin{table}[!htbp] \centering 
  \caption{Panel data with fixed time effect poly} 
  \label{} 
\begin{tabular}{@{\extracolsep{-10pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} } 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{4}{c}{Yield} \\ 
\cline{2-5} 
 & \multicolumn{1}{c}{Only climate variables} & \multicolumn{1}{c}{linear} & \multicolumn{1}{c}{quartic} & \multicolumn{1}{c}{Intersection} \\ 
\hline \\[-1.8ex] 
 poly(log(fall\_t), 2)1 & -8.096^{***} & -7.946^{***} & -8.030^{***} & -10.271 \\ 
  & (1.173) & (1.184) & (1.187) & (9.071) \\ 
  poly(log(fall\_t), 2)2 & 0.443 & 0.350 & 0.534 & 0.340 \\ 
  & (0.312) & (0.323) & (0.329) & (0.372) \\ 
  poly(winter\_t, 2)1 & -7.065^{***} & -6.683^{***} & -6.879^{***} & 1.615 \\ 
  & (0.899) & (0.907) & (0.926) & (4.048) \\ 
  poly(winter\_t, 2)2 & -1.160^{***} & -1.072^{***} & -1.057^{***} & -1.073^{***} \\ 
  & (0.279) & (0.280) & (0.280) & (0.280) \\ 
  poly(log(spring\_t), 2)1 & -9.967^{***} & -10.428^{***} & -10.028^{***} & -19.885^{**} \\ 
  & (1.095) & (1.106) & (1.110) & (8.014) \\ 
  poly(log(spring\_t), 2)2 & -0.867^{***} & -0.924^{***} & -0.753^{***} & -0.996^{***} \\ 
  & (0.269) & (0.274) & (0.276) & (0.288) \\ 
  poly(log(fall\_p), 2)1 & 2.270^{***} & 2.431^{***} & 2.511^{***} & 2.337^{***} \\ 
  & (0.421) & (0.428) & (0.427) & (0.432) \\ 
  poly(log(fall\_p), 2)2 & -3.553^{***} & -3.582^{***} & -3.522^{***} & -3.653^{***} \\ 
  & (0.247) & (0.249) & (0.249) & (0.253) \\ 
  poly(log(winter\_p), 2)1 & 2.693^{***} & 2.630^{***} & 2.635^{***} & 2.519^{***} \\ 
  & (0.585) & (0.587) & (0.586) & (0.591) \\ 
  poly(log(winter\_p), 2)2 & -1.832^{***} & -1.786^{***} & -1.934^{***} & -1.775^{***} \\ 
  & (0.262) & (0.262) & (0.264) & (0.265) \\ 
  poly(log(spring\_p), 2)1 & 0.106 & 0.196 & 0.246 & 0.207 \\ 
  & (0.415) & (0.416) & (0.418) & (0.417) \\ 
  poly(log(spring\_p), 2)2 & -4.917^{***} & -4.793^{***} & -4.889^{***} & -4.747^{***} \\ 
  & (0.256) & (0.259) & (0.259) & (0.261) \\ 
  log(aot\_fall) &  & 0.049 &  & -0.081 \\ 
  &  & (0.033) &  & (0.461) \\ 
  log(aot\_winter) &  & -0.048^{**} &  & -0.038^{*} \\ 
  &  & (0.020) &  & (0.021) \\ 
  log(aot\_spring) &  & 0.090^{***} &  & -0.294 \\ 
  &  & (0.032) &  & (0.315) \\ 
  poly(log(aot\_fall), 2)1 &  &  & 0.372 &  \\ 
  &  &  & (0.571) &  \\ 
  poly(log(aot\_fall), 2)2 &  &  & -0.751^{**} &  \\ 
  &  &  & (0.302) &  \\ 
  poly(log(aot\_winter), 2)1 &  &  & -0.553 &  \\ 
  &  &  & (0.587) &  \\ 
  poly(log(aot\_winter), 2)2 &  &  & 1.321^{***} &  \\ 
  &  &  & (0.303) &  \\ 
  poly(log(aot\_spring), 2)1 &  &  & 0.868 &  \\ 
  &  &  & (0.618) &  \\ 
  poly(log(aot\_spring), 2)2 &  &  & -0.382 &  \\ 
  &  &  & (0.305) &  \\ 
  log(aot\_fall):log(fall\_t) &  &  &  & 0.052 \\ 
  &  &  &  & (0.180) \\ 
  log(aot\_winter):winter\_t &  &  &  & -0.013^{**} \\ 
  &  &  &  & (0.006) \\ 
  log(aot\_spring):log(spring\_t) &  &  &  & 0.152 \\ 
  &  &  &  & (0.128) \\ 
 \hline \\[-1.8ex] 
Time fixed effect & \multicolumn{1}{c}{Yes} & \multicolumn{1}{c}{Yes} & \multicolumn{1}{c}{Yes} & \multicolumn{1}{c}{Yes} \\ 
\hline \\[-1.8ex] 
Observations & \multicolumn{1}{c}{2,979} & \multicolumn{1}{c}{2,979} & \multicolumn{1}{c}{2,979} & \multicolumn{1}{c}{2,979} \\ 
R$^{2}$ & \multicolumn{1}{c}{0.641} & \multicolumn{1}{c}{0.642} & \multicolumn{1}{c}{0.645} & \multicolumn{1}{c}{0.643} \\ 
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.621} & \multicolumn{1}{c}{0.623} & \multicolumn{1}{c}{0.625} & \multicolumn{1}{c}{0.623} \\ 
\hline 
\hline \\[-1.8ex] 
\textit{Note:}  & \multicolumn{4}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ 
 & \multicolumn{4}{r}{*Average and square temperature of Winter are not in log form due to negative values.} \\ 
\end{tabular} 
\end{table}

事实证明,输出中的顺序没有改变。我在观星台的订单代码无效。我可以在TeXstudio中手动更改顺序。但是如果我们能在观星台上做到这一点会更好。

0 个答案:

没有答案
相关问题