自变量加 1 个标准差的线性回归

Linear regression with independent variable plus 1 Standard Deviation

这一定是一个非常简单的问题,但我不确定我是否做对了:

我想执行多元线性回归,其中我想包括自变量 (Indv3) 在 1 个标准差 (SD) 中变化的影响

换句话说:如果 'Indv3' 改变 1SD,因变量 (Depv) 是如何关联到它的?

我所做的是:计算 'Indv3' 的 SD 值,并用 'Indv3' + 1SD-value = 1 创建一个虚拟变量 (Indv3_plusSD),其余的获得值0.

然后为了进行线性回归,我添加了 'Indv3_plusSD' 虚拟变量并执行回归。然而,当我这样做时,我得到了 'Depv' 的另一个 beta 系数,与已经发表在论文中的相同数据的分析相比......(所以我可能在 SD 分析中做错了:)

       Depv      Indv1 Indv2   Indv3    Indv3_plusSD
1   1.1555864       48    1  77.07593       0
2   1.0596864       61    2  69.51333       0
3   0.8380413       51    1  87.38040       0
4   1.5305489       53    2  67.43750       0
5   1.0619884       55    1 165.99977       1
6   0.8474507       56    2 229.14570       1
7   0.9579580       64    2 121.89550       0
8   0.7432210       58    1 211.17690       1
9   0.8374197       60    1 139.69577       0
10  0.7378349       65    1 277.03920       1
11  0.6971632       61    1 195.72100       1
12  0.5227076       64    2 194.63220       1
13  0.9900380       52    1 138.25417       0
14  0.8954233       52    2 237.39020       1
15  0.9058147       56    1 123.42930       0
16  0.9436135       55    2 152.75953       1
17  0.7123374       55    1 190.34547       1
18  1.1928167       58    1 166.50990       1
19  1.3342048       47    2  76.35120       0
20  1.0881865       49    1 135.71740       0
21  2.9028876       48    2  61.83147       0
22  0.6661121       61    1 139.68627       0

linregr <- lm(Depv ~ Indv1 + Indv2 + Indv3_plusSD, data = df)   

在没有你的 SD 项的情况下对 Indv1Indv2Indv3 进行回归:
linregr <- lm(Depv ~ Indv1 + Indv2 + Indv3, data = df)

Indv3 的回归系数是 Depv 的预计变化量 Indv3 的单位变化,因此 Depv 的变化量将随着变化而变化Indv3 中的 1 个 SD 是 SD *(Indv3 的系数)。

library(tidyverse)
df = read_table2('Depv      Indv1 Indv2   Indv3
1.1555864       48    1  77.07593
1.0596864       61    2  69.51333
0.8380413       51    1  87.38040
1.5305489       53    2  67.43750
1.0619884       55    1 165.99977
0.8474507       56    2 229.14570
0.9579580       64    2 121.89550
0.7432210       58    1 211.17690
0.8374197       60    1 139.69577
0.7378349       65    1 277.03920
0.6971632       61    1 195.72100
0.5227076       64    2 194.63220
0.9900380       52    1 138.25417
0.8954233       52    2 237.39020
0.9058147       56    1 123.42930
0.9436135       55    2 152.75953
0.7123374       55    1 190.34547
1.1928167       58    1 166.50990
1.3342048       47    2  76.35120
1.0881865       49    1 135.71740
2.9028876       48    2  61.83147
0.6661121       61    1 139.68627') %>% 
  mutate(Indv3_scale = scale(Indv3))

(sd3 = sd(df$Indv3))
#> [1] 60.84117

model1 =  lm(Depv ~ Indv1 + Indv2 + Indv3, data = df)   
model2 =  lm(Depv ~ Indv1 + Indv2 + Indv3_scale, data = df)   

coef(model1)['Indv3'] * sd3
#>      Indv3 
#> -0.1609104
coef(model2)['Indv3_scale']
#> Indv3_scale 
#>  -0.1609104

reprex package (v0.3.0)

于 2020-01-14 创建