【问题标题】:Alternatives for regression output using miEconAids (besides `stargazer`)使用 miEconAids 的回归输出的替代方案(除了 `stargazer`)
【发布时间】:2018-11-07 06:07:22
【问题描述】:

我正在使用库 micEconAids 从估计中寻找更漂亮的输出。 stargazer 似乎不起作用,除非我使用 lm 或其他看似不相关的方程的回归包“手动”估计方程。包实现的一些方法我可以自己复制,但不是全部。

那么,除了summary 的回归输出之外,还有什么替代方法可以给我更好的输出?

下面我粘贴了一些代码来举例说明问题:

rm(list=ls())

library(micEconAids)

data(Blanciforti86)

priceNames = c( "pFood1", "pFood2", "pFood3", "pFood4" )
shareNames = c( "wFood1", "wFood2", "wFood3", "wFood4" )

laaidsResult1 = aidsEst( priceNames, shareNames, "xFood", data = Blanciforti86,
                         priceIndex = "S"  )

laaidsResult2 = aidsEst( priceNames, shareNames, "xFood", data = Blanciforti86,
                        priceIndex = "P"  )

laaidsResult3 = aidsEst( priceNames, shareNames, "xFood", data = Blanciforti86,
                        priceIndex = "SL"  )

summary(laaidsResult1)
summary(laaidsResult2)
summary(laaidsResult3)

#Stargazer does not work with `micEconAids`:

stargazer::stargazer(laaidsResult1, laaidsResult2, laaidsResult3)

#What are the alternatives for showing a prettier output?

#######################################################################################################################

#In the previous examples, an AIDS model was regressed.
#Below there is an example of how the models could/should look like -- in a three equation setup --
#using `lm` function, which works with `stargazer`.


reg1 = lm(Blanciforti86$wFood1 ~ Blanciforti86$pFood1)
reg2 = lm(Blanciforti86$wFood2 ~ Blanciforti86$pFood2)
reg3 = lm(Blanciforti86$wFood3 ~ Blanciforti86$pFood3)

stargazer::stargazer(reg1,reg2,reg3, type="text")

【问题讨论】:

    标签: r regression stargazer


    【解决方案1】:

    aidsEst 的输出在列表结构中包含大量信息。 如果您要检查特定的输出集,可以将其拉出并使用broom::tidy() 以更好的格式查看。

    例如,aidsEst() 包含一个 $coef 对象,而该对象又具有一个 $stat 数据框。
    使用tidy()

    tidy(laaidsResult1$coef$stat)
    
       .rownames     Estimate  Std..Error    t.value     Pr...t..
    1    alpha 1 -0.247298293 0.070079963 -3.5288017 6.798727e-04
    2    alpha 2  0.109249097 0.057874966  1.8876745 6.252270e-02
    3    alpha 3  0.268238436 0.034413442  7.7945832 1.560840e-11
    4    alpha 4  0.869810761 0.090578360  9.6028539 3.635728e-15
    5     beta 1  0.323989176 0.041041424  7.8941991 9.873279e-12
    6     beta 2  0.055863164 0.033599356  1.6626261 1.001146e-01
    7     beta 3 -0.078626097 0.020025657 -3.9262681 1.760820e-04
    8     beta 4 -0.301226244 0.052987085 -5.6848993 1.848756e-07
    9  gamma 1 1  0.104150200 0.020804442  5.0061521 3.018569e-06
    10 gamma 1 2 -0.139880152 0.015303438 -9.1404395 3.094504e-14
    

    使用str(laaidsResult1)aidsEst 输出中查找您要查找的特定内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-06
      • 2012-11-24
      • 1970-01-01
      • 1970-01-01
      • 2015-06-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多