Linear regression with independent variable plus 1 Standard Deviation

huangapple go评论103阅读模式
英文:

Linear regression with independent variable plus 1 Standard Deviation

问题

这是您提供的代码部分,无需翻译:

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

请继续您的工作。

英文:

This must be a really simple question though Im not sure if I do it correctly:

I want to perform a multiple lineair regression where I want to include the effect of an independent variable (Indv3) change in 1 standard deviation (SD)

In other words: if 'Indv3' changes 1SD, how is the dependent (Depv) variable associated to it?

What I did was: calculate the SD-value of 'Indv3' and make a dummy variable (Indv3_plusSD) with 'Indv3' + 1SD-value = 1 and the rest gets value 0.

Then to do the lineair regression I add the 'Indv3_plusSD' dummy and execute the regression. However when I do this I get another beta-coefficient for the 'Depv' compared to an analysis with the same data already published in a paper...(so prob Im doing it wrong with the SD analysis Linear regression with independent variable plus 1 Standard Deviation

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

答案1

得分: 0

以下是您提供的内容的中文翻译:

在不使用您的标准差项的情况下,对Indv1Indv2Indv3进行回归:
linregr <- lm(Depv ~ Indv1 + Indv2 + Indv3, data = df)

Indv3的回归系数是预测在Indv3单位变化时Depv将会变化的数量,因此在Indv3变化1个标准差时,Depv将变化的数量为标准差乘以(Indv3的系数)。

  1. library(tidyverse)
  2. df = read_table2('Depv Indv1 Indv2 Indv3
  3. 1.1555864 48 1 77.07593
  4. 1.0596864 61 2 69.51333
  5. 0.8380413 51 1 87.38040
  6. 1.5305489 53 2 67.43750
  7. 1.0619884 55 1 165.99977
  8. 0.8474507 56 2 229.14570
  9. 0.9579580 64 2 121.89550
  10. 0.7432210 58 1 211.17690
  11. 0.8374197 60 1 139.69577
  12. 0.7378349 65 1 277.03920
  13. 0.6971632 61 1 195.72100
  14. 0.5227076 64 2 194.63220
  15. 0.9900380 52 1 138.25417
  16. 0.8954233 52 2 237.39020
  17. 0.9058147 56 1 123.42930
  18. 0.9436135 55 2 152.75953
  19. 0.7123374 55 1 190.34547
  20. 1.1928167 58 1 166.50990
  21. 1.3342048 47 2 76.35120
  22. 1.0881865 49 1 135.71740
  23. 2.9028876 48 2 61.83147
  24. 0.6661121 61 1 139.68627') %>%
  25. mutate(Indv3_scale = scale(Indv3))
  26. (sd3 = sd(df$Indv3))
  27. #> [1] 60.84117
  28. model1 = lm(Depv ~ Indv1 + Indv2 + Indv3, data = df)
  29. model2 = lm(Depv ~ Indv1 + Indv2 + Indv3_scale, data = df)
  30. coef(model1)['Indv3'] * sd3
  31. #> Indv3
  32. #> -0.1609104
  33. coef(model2)['Indv3_scale']
  34. #> Indv3_scale
  35. #> -0.1609104

创建于2020年01月14日,使用reprex包 (v0.3.0)

英文:

Regress against Indv1, Indv2 and Indv3 without your SD term:
linregr &lt;- lm(Depv ~ Indv1 + Indv2 + Indv3, data = df)

The regression coefficient for Indv3 is the amount Depv is predicted to change for a unit change in Indv3, so the amount Depv will change for a change of 1 SD in Indv3 is SD * (coefficient of Indv3).

<!-- language-all: lang-r -->

  1. library(tidyverse)
  2. df = read_table2(&#39;Depv Indv1 Indv2 Indv3
  3. 1.1555864 48 1 77.07593
  4. 1.0596864 61 2 69.51333
  5. 0.8380413 51 1 87.38040
  6. 1.5305489 53 2 67.43750
  7. 1.0619884 55 1 165.99977
  8. 0.8474507 56 2 229.14570
  9. 0.9579580 64 2 121.89550
  10. 0.7432210 58 1 211.17690
  11. 0.8374197 60 1 139.69577
  12. 0.7378349 65 1 277.03920
  13. 0.6971632 61 1 195.72100
  14. 0.5227076 64 2 194.63220
  15. 0.9900380 52 1 138.25417
  16. 0.8954233 52 2 237.39020
  17. 0.9058147 56 1 123.42930
  18. 0.9436135 55 2 152.75953
  19. 0.7123374 55 1 190.34547
  20. 1.1928167 58 1 166.50990
  21. 1.3342048 47 2 76.35120
  22. 1.0881865 49 1 135.71740
  23. 2.9028876 48 2 61.83147
  24. 0.6661121 61 1 139.68627&#39;) %&gt;%
  25. mutate(Indv3_scale = scale(Indv3))
  26. (sd3 = sd(df$Indv3))
  27. #&gt; [1] 60.84117
  28. model1 = lm(Depv ~ Indv1 + Indv2 + Indv3, data = df)
  29. model2 = lm(Depv ~ Indv1 + Indv2 + Indv3_scale, data = df)
  30. coef(model1)[&#39;Indv3&#39;] * sd3
  31. #&gt; Indv3
  32. #&gt; -0.1609104
  33. coef(model2)[&#39;Indv3_scale&#39;]
  34. #&gt; Indv3_scale
  35. #&gt; -0.1609104

<sup>Created on 2020-01-14 by the reprex package (v0.3.0)</sup>

huangapple
  • 本文由 发表于 2020年1月3日 21:27:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579434.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定