繁体   English   中英

从多元线性回归中获取部分 R2 值

[英]Getting partial R2 values from a Multivariate Linear regression

我有一个带有多个预测变量的线性 model,我想知道每个预测变量的部分 R2 值。 我在summary output 中看到了部分 p 值,但没有看到部分 R2。 我需要为此下载额外的软件包吗?

df <- mtcars

mod.mlr <-summary( lm(mpg ~., data = df))

您可以使用 R package sensemakr 的function partial_r2来计算部分 R2。

library(sensemakr)
#> See details in:
#> Carlos Cinelli and Chad Hazlett (2020). Making Sense of Sensitivity: Extending Omitted Variable Bias. Journal of the Royal Statistical Society, Series B (Statistical Methodology).

df <- mtcars

model <- lm(mpg ~., data = df)

partial_r2(model)
#>  (Intercept)          cyl         disp           hp         drat           wt 
#> 0.0201591032 0.0005412271 0.0258677677 0.0443187825 0.0109107458 0.1548024114 
#>         qsec           vs           am         gear         carb 
#> 0.0566909597 0.0010844617 0.0667336071 0.0090902140 0.0027495993

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM