#Biostatistics 400 #MULTIPLE REGRESSION MODEL SS #ZAR EXAMPLE 20.1a ZAR=read.table("ZarEX20.1aR.txt") ZAR attach(ZAR) Y=var5 X1=var1 X2=var2 X3=var3 X4=var4 #DOWNLOAD {CAR} PACKAGE FROM CRAN: library(car) #TYPE 2 SS: FM=lm(Y~X1+X2+X3+X4) summary(FM) Anova(FM) drop1(FM) # equivalent to Anova() but also gives AIC #REDUCED MODELS: RM1=lm(Y~X2+X3+X4) #subtracting X1 RM2=lm(Y~X1+X3+X4) #subtracting X2 RM3=lm(Y~X1+X2+X4) #subtracting X3 RM4=lm(Y~X1+X2+X3) #subtracting X4 Anova(RM1) Anova(RM2) Anova(RM3) Anova(RM4) TYPE 1 SS: anova(FM) FM1=lm(Y~X1+X2) RM1=lm(Y~X1) anova(FM1) anova(RM1)