简体   繁体   English

对 systemfit 对象使用 stargazer

[英]Using stargazer for systemfit objects

I wonder how to use stargazer for systemfit objects.我想知道如何将 stargazer 用于 systemfit 对象。 My working example is below which gives two different tables rather than one.下面是我的工作示例,它给出了两个不同的表而不是一个。

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
  )

It can be done using texreg function from texreg package:可以使用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}

Not supported yet, but planned for a future release.尚不支持,但计划在未来发布。 If you have any suggestion regarding what the final table should look like (and/or what is important in systemfit regression table output), please e-mail stargazer 's author.如果您对最终表格的外观(和/或 systemfit 回归表格输出中的重要内容)有任何建议,请发送电子邮件至stargazer的作者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM