观星器输出多个模型r



我对面板线性模型(具有两个固定效应(id和year)的固定效应模型)进行了三种不同的估计。

fixed_YIELD_mean_to_treat.100 <- plm(YIELD_mean_total ~  treated.100 + Nightlight_sum + Population_sum + temp_mean, data= Results, index = c("id", "year"), model = "within")
fixed_YIELD_mean_fruits_treat.100<- plm(YIELD_mean_Fruit ~  treated.100 + Nightlight_sum + Population_sum + temp_mean, data= Results, index = c("id", "year"), model = "within")
fixed_YIELD_mean_grain_treat.100<- plm(YIELD_mean_Cereal ~  treated.100 + Nightlight_sum + Population_sum + temp_mean, data= Results, index = c("id", "year"), model = "within")

现在我尝试创建一个包含所有三个模型的观星器输出:

stargazer( fixed_YIELD_mean_to_treat.100, fixed_YIELD_mean_fruits_treat.100, fixed_YIELD_mean_grain_treat.100, 
                   type = "html",
                   align = TRUE,
                   omit = c("year", "id"),
                   omit.labels = c("year FE", "id FE"),
                   add.lines= list(c("ID Fixed effects", "Yes", "Yes", "Yes"),
                                  c("Time Fixed effects", "Yes", "Yes", "Yes")),
                   out = ".test1.html" )

但是我得到了错误:

Error in if (is.na(s)) { : the condition has length > 1

如果我只包含2个模型,它总是有效的。我如何在一个观星器输出中绘制三个模型?

正如注释所说,尽量使用更短的模型名:

library("plm")
data("Produc", package="plm")
fe1 <- plm(pcap ~ hwy + water + unemp, data=Produc, index=c("state", "year"), model = "within")
fe2 <- plm(pcap ~ hwy + water + emp, data=Produc, index=c("state", "year"), model = "within")
fe3 <- plm(pcap ~ hwy + water + pc, data=Produc, index=c("state", "year"), model = "within")
stargazer(fe1, fe2, fe3, type="text")
================================================================
                                   Dependent variable:          
                          --------------------------------------
                                           pcap                 
                              (1)          (2)          (3)     
----------------------------------------------------------------
hwy                         2.023***     2.015***     1.999***  
                            (0.052)      (0.050)      (0.051)   
                                                                
water                       1.974***     1.989***     1.935***  
                            (0.043)      (0.058)      (0.063)   
                                                                
unemp                       -14.624                             
                            (19.682)                            
                                                                
emp                                       -0.073                
                                         (0.161)                
                                                                
pc                                                     0.003    
                                                      (0.004)   
                                                                
----------------------------------------------------------------
Observations                  816          816          816     
R2                           0.901        0.901        0.901    
Adjusted R2                  0.895        0.895        0.895    
F Statistic (df = 3; 765) 2,332.767*** 2,331.602*** 2,332.963***
================================================================
Note:                                *p<0.1; **p<0.05; ***p<0.01

相关内容

  • 没有找到相关文章