I have a question regarding statistically adjustment.
I have a multiple linear regression modell like this
bodysize <- data.frame(
stringsAsFactors = FALSE,
humansize = c(166,159,161,162,155,155,178,165,163,169,170,171,172,172,173,166,167,157,159,160,178,173,168,167,166,165,166,164,162,163, 190,191,192,193,195,199,189,188,187,185,183,181,188,189,200,201,198,179,178,177,176,177,173,175,176,188,185,183,181,196),
Temperature = c(25,23,24,25,24,23,12,19,20,15,13,9,9,8,12,11,26,29,30,11,12,13,10,14,15,16,17,13,11,9,7,8,9,9,9,10,12,13,12,14,13,25,13,7,6,8,7,6,23,24,25,26,27,27,23,21,12,13,14,10),
airpollution = c(95,93,84,85,88,93,52,39,72,58,27,38,34,23,62,61,56,99,99,44,42,43,30,44,45,76,67,63,51,29,27,28,39,29,29,30,32,33,32,54,53,85,63,17,16,18,17,16,76,84,85,87,67,67,63,81,32,13,34,40),
SES= c(25,13,34,25,28,13,32,79,12,68,87,58,54,53,12,11,36,9,9,74,72,43,30,44,45,16,17,53,51,89,87,78,69,79,89,60,52,33,32,54,53,65,63,67,66,78,77,67,20,4,5,7,7,7,13,11,62,73,34,40),
Gender = c("female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","male")
)
humansize <- lm(humansize~Temperature airpollution SES factor(Gender), data = bodysize)
summary(humansize)
confint(humansize)
This is my modell. I would do a statistical adjustment without the variables temperature and airpollution, because they are confounders. How can I do that?
I would like to know how human size would be if temperature and air pollution are adjusted for
CodePudding user response:
Typically 'statistical adjusting' for some covariates means running a linear model with said covariates and then taking the residuals from that model. In your case, it would simply be
humansize$residuals
6.43345246 -1.64591706 0.49132162 2.36454718 -5.34769995 -5.64591706
7 8 9 10 11 12
9.32077018 -0.15042732 0.23298624 1.56024709 0.59173459 -0.35246626
13 14 15 16 17 18
0.70891584 -0.01085447 4.83439654 -2.81646849 7.58633582 0.48163364
19 20 21 22 23 24
3.14784419 -10.33447884 8.36242277 4.68036940 -2.11877044 -0.66876558
25 26 27 28 29 30
-1.01790055 -0.49323807 1.08872167 -4.40418057 -7.77481591 -9.10379867
31 32 33 34 35 36
-2.36715056 -0.49392500 1.44820585 2.15694003 3.93457950 9.25252613
37 38 39 40 41 42
0.77661671 0.87220281 -0.77866222 -1.78384266 -4.43470769 1.51348321
43 44 45 46 47 48
0.41183706 -2.99133477 7.35780020 9.43716972 5.78630469 -13.66443585
49 50 51 52 53 54
-1.88033025 -1.80321862 -2.15235359 -0.51683409 -3.98843410 -1.98843410
55 56 57 58 59 60
-3.81425475 7.02182576 -3.44574382 -5.15504989 -5.47693216 6.76615248