I have made these two models:
(model1 <- summary(lm(mpg ~ drat + wt + cyl, mtcars)))
Call:
lm(formula = mpg ~ drat + wt + cyl, data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-4.2944 -1.5576 -0.4667 1.5678 6.1014
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 39.7677 6.8729 5.786 3.26e-06 ***
drat -0.0162 1.3231 -0.012 0.990317
wt -3.1947 0.8293 -3.852 0.000624 ***
cyl -1.5096 0.4464 -3.382 0.002142 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.613 on 28 degrees of freedom
Multiple R-squared: 0.8302, Adjusted R-squared: 0.812
F-statistic: 45.64 on 3 and 28 DF, p-value: 6.569e-11
(model2 <- summary(lm(mpg ~ wt + cyl + drat, mtcars)))
Call:
lm(formula = mpg ~ wt + cyl + drat, data = mtcars)
Residuals:
Min 1Q Median 3Q Max
-4.2944 -1.5576 -0.4667 1.5678 6.1014
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 39.7677 6.8729 5.786 3.26e-06 ***
wt -3.1947 0.8293 -3.852 0.000624 ***
cyl -1.5096 0.4464 -3.382 0.002142 **
drat -0.0162 1.3231 -0.012 0.990317
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.613 on 28 degrees of freedom
Multiple R-squared: 0.8302, Adjusted R-squared: 0.812
F-statistic: 45.64 on 3 and 28 DF, p-value: 6.569e-11
My understanding is that R uses "sequential" partitioning for the variance in mpg
. So in model1
, drat
should be unadjusted, wt
should be adjusted for drat
and cyl
should be adjusted for drat
and wt
. In model2
, wt
should be unadjusted, cyl
should be adjusted for wt
and drat
should be adjusted for wt
and cyl
.
However, the coefficients in each model appear to be exactly the same, suggesting coefficients are not being adjusted at all. Are the coefficients not being adjusted at all?