source("http://www.uvm.edu/~rsingle/stat221/data/scripts-221.R") dat <- bookdata("ch05q02.txt") head(dat) y.x1x2 <- lm(SBP~QUET+AGE, data=dat) anova(y.x1x2) y.x1 <- lm(SBP~QUET, data=dat) anova(y.x1) #Variable Added Last (VAL) tests vs. Variable In Order (VIO) tests summary(y.x1) #VAL test for Beta_1 matches anova(y.x1) for SLR anova(y.x1) anova(y.x1x2) #VIO tests for Beta_i #VIO test for Beta_2 (only) matches VAL test summary(y.x1x2) #VAL tests for Beta_i y.x2x1 <- lm(SBP~AGE+QUET, data=dat) summary(y.x2x1) #VAL tests are the same as y.x2x1 (order does NOT matter) anova(y.x2x1) #VIO tests are NOT the same as y.x2x1 (order DOES matter) anova(y.x1x2) anova(y.x1) y.x2 <- lm(SBP~AGE, data=dat) summary(y.x2) anova(y.x2) y.x2x1 <- lm(SBP~AGE+QUET, data=dat) summary(y.x2x1) anova(y.x2x1)