Unprecise p-values in Stargazer

前端 未结 3 1377
傲寒
傲寒 2021-02-20 10:32

I want the same stars for significancies in regression output in stargazer as in the \"normal output\".

I produce data

library(\"stargazer\"); library(\"         


        
3条回答
  •  猫巷女王i
    2021-02-20 11:31

    You need to provide the p values associated with your coeftest. From the man page.

    p a list of numeric vectors that will replace the default p-values for each model. Matched by element names. These will form the basis of decisions about significance stars

    The following should work.

    test <- coeftest(model, vcov = vcovHC(model, type="HC3"))
    ses <- test[, 2]
    pvals <- test[, 4]
    stargazer(model, type="text", p=pvals, se=ses)
    

    This provides the following.

    ===============================================
                            Dependent variable:    
                        ---------------------------
                                  log(y)           
    -----------------------------------------------
    x                            -0.00005          
    
    
    Constant                     6.956***          
                                  (0.003)          
    
    -----------------------------------------------
    Observations                    100            
    R2                             0.026           
    Adjusted R2                    0.016           
    Residual Std. Error       0.027 (df = 98)      
    F Statistic             2.620 (df = 1; 98)     
    ===============================================
    Note:               *p<0.1; **p<0.05; ***p<0.01
    

提交回复
热议问题