如何在观星计划中报告标准化模型?
我制作了以下简单的回归模型,并使用Stargazer输出绘制标准化与非标准化回归模型系数,标准误差和P值的表。
library(lm.beta)
mod <- lm(mpg ~ cyl + disp, mtcars)
summary(mod)
mod_std <- lm.beta(mod)
summary(mod_std)$coe[, 2]
library(stargazer)
stargazer(mod, mod_std,
coef = list(mod$coefficients,
mod_std$standardized.coefficients),
type='text')
这就是输出:
==========================================================
Dependent variable:
----------------------------
mpg
(1) (2)
----------------------------------------------------------
cyl -1.587** -0.470
(0.712) (0.712)
disp -0.021** -0.423***
(0.010) (0.010)
Constant 34.661*** 0.000
(2.547) (2.547)
----------------------------------------------------------
Observations 32 32
R2 0.760 0.760
Adjusted R2 0.743 0.743
Residual Std. Error (df = 29) 3.055 3.055
F Statistic (df = 2; 29) 45.808*** 45.808***
==========================================================
Note: *p<0.1; **p<0.05; ***p<0.01
如这里可以观察到的那样,标准化模型和非标准化的模型报道的标准误差(对于系数)是相同的。这是不正确的,因为标准误差应随着系数的标准化而改变。有没有办法报告正确的标准错误?还是如果没有,只需删除它们?
最后,从标准化到非标准化模型的变化是(系数)的显着性水平。这些不应改变,因为它们不受标准化的影响。有没有办法防止观星修改它们? P或P.Auto的论点可能会起作用,但我不知道如何使用它们。
LM.Beta的参考:Stefan Behrendt(2014)。 lm.Beta:向LM对象添加标准化的回归系数。 R软件包版本1.5-1。 https://cran.r-project.org/package = lm.beta
I made the following simple regression model and used stargazer to output a table that plots the standardized vs non-standardized regression model coefficients, standard errors and p-values.
library(lm.beta)
mod <- lm(mpg ~ cyl + disp, mtcars)
summary(mod)
mod_std <- lm.beta(mod)
summary(mod_std)$coe[, 2]
library(stargazer)
stargazer(mod, mod_std,
coef = list(mod$coefficients,
mod_std$standardized.coefficients),
type='text')
And this is the output:
==========================================================
Dependent variable:
----------------------------
mpg
(1) (2)
----------------------------------------------------------
cyl -1.587** -0.470
(0.712) (0.712)
disp -0.021** -0.423***
(0.010) (0.010)
Constant 34.661*** 0.000
(2.547) (2.547)
----------------------------------------------------------
Observations 32 32
R2 0.760 0.760
Adjusted R2 0.743 0.743
Residual Std. Error (df = 29) 3.055 3.055
F Statistic (df = 2; 29) 45.808*** 45.808***
==========================================================
Note: *p<0.1; **p<0.05; ***p<0.01
As can be observed here, the standard errors that are reported by the stargazer (for the coefficients) are the same for the standardized model and the non-standardized one. This is not correct as standard errors should change with the standardization of coefficients. Is there a way to report the correct standard errors? Or if not, simply remove them?
Lastly, what also changes from the standardized to the non-standardized models are the significance levels (of the coefficients). These should not change as they are not affected by standardization. Is there a way to prevent stargazer from modifying them? p or p.auto arguments maybe would work but I have no idea how to use them.
Reference for lm.beta: Stefan Behrendt (2014). lm.beta: Add Standardized Regression Coefficients to lm-Objects. R package version 1.5-1. https://CRAN.R-project.org/package=lm.beta
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从系数开始时,您将需要手动输入每个模型的其他值, list 。标准化
se =
,p =
值(对于星星),以及GOFS( r 2 ) ,r 2 adj。,... ),在帮助页面中读取选项:?stargazer
。但是,
lm.beta
似乎只添加了标准化系数,而没有计算出来。使用公式 se*beta_star/beta/beta 来计算标准化的标准错误。
因此,您可以包装功能并计算它们,以便在
Stargazer
表中填充它们:但是,计算实际的标准化模型
并将其放入以下方式肯定会更容易:
You would need to enter the additional values by hand,
list
-wise for each model, as you started with the coefficients. Standardizedse=
, thep=
values (for the stars), ... as well as the the GOFs (R2, R2adj., ...), read options in help page:?stargazer
.However,
lm.beta
appears to add nothing but the standardized coefficients, and none are yet calculated to report them.Standardized standard errors are calculated using the formula SE*beta_star/beta.
So you could wrap a function, and calculate them, in order to fill them in the
stargazer
table:However, it might definitely be easier to calculate a actual standardized model
and put that in:
我设法制作了以下脚本:
随着以下输出:
在这里,报告了标准化系数,以及原始模型的p值(应在标准化中不变)。
I managed to make the following script:
With the following output:
Here, the standardized coefficients are reported, together with the p-values from the original model (which should be unchanged across standardization).