将stargazer用于systemfit对象

问题描述 投票:0回答:2

我想知道如何将stargazer用于systemfit对象。我下面的工作示例提供了两个不同的表,而不是一个。

library("systemfit")
data("Kmenta")
eqDemand <- consump ~ price + income
eqSupply <- consump ~ price + farmPrice + trend
eqSystem <- list(demand = eqDemand, supply = eqSupply)
fitols   <- systemfit(eqSystem, data=Kmenta)
fitsur <- systemfit(eqSystem, method = "SUR", data=Kmenta)

library(stargazer)

stargazer(
      coef(fitols)
    , coef(fitsur)
    , title="Regression Results"
    , align=TRUE
  )
r latex knitr stargazer systemfit
2个回答
1
投票

可以使用texreg包中的texreg功能来完成:

texreg(list(fitols, fitsur))

\begin{table}
\begin{center}
\begin{tabular}{l c c c c }
\hline
            & Model 1 & Model 2 & NA & NA \\
\hline
(Intercept) & $99.90^{***}$ & $58.28^{***}$ & $99.33^{***}$ & $61.97^{***}$ \\
            & $(7.52)$      & $(11.46)$     & $(7.51)$      & $(11.08)$     \\
price       & $-0.32^{**}$  & $0.16$        & $-0.28^{**}$  & $0.15$        \\
            & $(0.09)$      & $(0.09)$      & $(0.09)$      & $(0.09)$      \\
income      & $0.33^{***}$  &               & $0.30^{***}$  &               \\
            & $(0.05)$      &               & $(0.04)$      &               \\
farmPrice   &               & $0.25^{***}$  &               & $0.21^{***}$  \\
            &               & $(0.05)$      &               & $(0.04)$      \\
trend       &               & $0.25^{*}$    &               & $0.34^{***}$  \\
            &               & $(0.10)$      &               & $(0.07)$      \\
\hline
R$^2$       & 0.76          & 0.65          & 0.76          & 0.61          \\
Adj. R$^2$  & 0.74          & 0.59          & 0.73          & 0.54          \\
Num. obs.   & 40            & 40            & 40            & 40            \\
\hline
\multicolumn{5}{l}{\scriptsize{$^{***}p<0.001$, $^{**}p<0.01$, $^*p<0.05$}}
\end{tabular}
\caption{Statistical models}
\label{table:coefficients}
\end{center}
\end{table}

0
投票

目前尚不支持,但计划在将来的版本中发布。如果您对最终表的外观(和/或在systemfit回归表输出中重要的表)有任何建议,请给stargazer的作者发送电子邮件。

© www.soinside.com 2019 - 2024. All rights reserved.