在观星台中包含标准化系数 [英] Including standardized coefficients in a stargazer table

查看:124
本文介绍了在观星台中包含标准化系数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列的线性模型,我想报告每个模型的标准化系数.但是,当我在观星器中打印模型时,看起来像观星器自动为标准化系数打印出重要恒星,就好像它们是非标准化系数一样.您可以在下面看到差异的产生方式.

I have a series of linear models and I'd like to report the standardized coefficients for each. However, when I print the models in stargazer, it looks like stargazer automatically prints the significance stars for the standardized coefficients as if they were unstandardized coefficients. You can see how the differences emerge below.

根据非标准化值打印显着性星标在统计上是否错误?在观星台中这是如何完成的?谢谢!

Is it statistically wrong to print the significance stars based on the unstandardized values? How is this done in stargazer? Thanks!

#load libraries
library(stargazer)
library(lm.beta)
#fake data
var1<-rnorm(100, mean=10, sd=5)
var2<-rnorm(100, mean=5, sd=2)
var3<-rnorm(100, mean=2, sd=3)
var4<-rnorm(100, mean=5, sd=1)
df<-data.frame(var1, var2, var3, var4)
#model with unstandardized betas
model1<-lm(var1~var2+var3+var4, data=df)
#Standardized betas
model1.beta<-lm.beta(model1)
#print
stargazer(model1, model1.beta, type='text')

推荐答案

Stargazer不会自动知道它应该在第二个模型中寻找标准化系数. lm.beta只需将标准系数添加到lm.object.因此它仍然是lm.object,因此它照常提取系数(从model1.beta$coefficients中提取.使用coef =参数指定要使用的特定系数:coef = list(model1$coefficients, model1.beta$standardized.coefficients)

Stargazer does not automatically know it should look for the standardized coefficients in the second model. lm.beta just add standardzied coefficients to the lm.object. So it is still an lm.object, so it extracts the coefficients as per usual (from model1.beta$coefficients. Use the coef = argument to specify the specific coefficients you want to use: coef = list(model1$coefficients, model1.beta$standardized.coefficients)

> stargazer(model1, model1.beta, 
            coef = list(model1$coefficients, 
            model1.beta$standardized.coefficients),
            type='text')

==========================================================
                                  Dependent variable:     
                              ----------------------------
                                          var1            
                                   (1)            (2)     
----------------------------------------------------------
var2                              0.135          0.048    
                                 (0.296)        (0.296)   

var3                              -0.088        -0.044    
                                 (0.205)        (0.205)   

var4                              -0.190        -0.030    
                                 (0.667)        (0.667)   

Constant                         10.195**        0.000    
                                 (4.082)        (4.082)   

----------------------------------------------------------
Observations                       100            100     
R2                                0.006          0.006    
Adjusted R2                       -0.025        -0.025    
Residual Std. Error (df = 96)     5.748          5.748    
F Statistic (df = 3; 96)          0.205          0.205    
==========================================================
Note:                          *p<0.1; **p<0.05; ***p<0.01

这篇关于在观星台中包含标准化系数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆