# # Epage 137 # # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- # version$language == "R" for R version$language == NULL for SPlus if(is.null(version$language) == FALSE) require(alr3) else library(alr3) if(is.null(version$language) == FALSE) data(domedata) if(is.null(version$language) == FALSE) pairs(domedata,gap=0.4,cex.labels=1.5,cex=0.5) else pairs(domedata) attach(domedata) D <- factor( Cond, ordered=FALSE ) m1 <- lm( Dist ~ Velocity + Angle + BallWt + BallDia + D ) # the most general model m2 <- lm( Dist ~ Velocity + Angle + BallWt + BallDia ) # remove the factor m3 <- lm( Dist ~ Velocity + Angle ) # remove some properites of the ball m4 <- lm( Dist ~ Velocity + Angle + D ) # remove some properites of the ball but add back in the factor #m5 <- lm( Dist ~ D ) dgts <- 3 print( c(m1$df.residual, sum( residuals(m1,type="pearson")^2 )), digits=dgts ) # compare all models to the most general model (model 1): # a2<-anova(m2,m1) print( c( a2$Res.Df[1], a2$RSS[1], a2$F[2], a2$'Pr(>F)'[2] ), digits=dgts ) a3<-anova(m3,m1) print( c( a3$Res.Df[1], a3$RSS[1], a3$F[2], a3$'Pr(>F)'[2] ), digits=dgts ) a4<-anova(m4,m1) print( c( a4$Res.Df[1], a4$RSS[1], a4$F[2], a4$'Pr(>F)'[2] ), digits=dgts )