Rforch24 - R Material for Chapter 24 > data.catapult...

This preview shows pages 1–3. Sign up to view the full content.

R Material for Chapter 24 > data.catapult <- read.table(file="http://www.stat.ufl.edu/~rrandles/sta4211/Rclassnotes/data/catapult.txt",co l.names=c("distance","tension","stop","pull")) > attach(data.catapult ) > data.catapult distance tension stop pull 1 124 1 1 1 2 121 1 1 1 3 111 2 1 1 4 113 2 1 1 5 124 1 2 1 6 130 1 2 1 7 114 2 2 1 8 113 2 2 1 9 120 1 1 2 10 118 1 1 2 11 109 2 1 2 12 109 2 1 2 13 123 1 2 2 14 121 1 2 2 15 111 2 2 2 16 114 2 2 2 > ften <- factor(tension) > fstop <- factor(stop) > fpull <- factor(pull) > model1 <- aov(distance~ften*fstop*fpull) > summary(model1) Df Sum Sq Mean Sq F value Pr(>F) ften 1 473.06 473.06 112.9701 5.374e-06 *** fstop 1 39.06 39.06 9.3284 0.01572 * fpull 1 39.06 39.06 9.3284 0.01572 * ften:fstop 1 1.56 1.56 0.3731 0.55825 ften:fpull 1 5.06 5.06 1.2090 0.30352 fstop:fpull 1 0.06 0.06 0.0149 0.90578 ften:fstop:fpull 1 3.06 3.06 0.7313 0.41732 Residuals 8 33.50 4.19 > model2 <- aov(distance~ften +fstop +fpull) > summary(model2) Df Sum Sq Mean Sq F value Pr(>F) ften 1 473.06 473.06 131.254 8.09e-08 *** fstop 1 39.06 39.06 10.838 0.006434 ** fpull 1 39.06 39.06 10.838 0.006434 ** Residuals 12 43.25 3.60 --- Signif. Codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > coefficients(model2) (Intercept) ften2 fstop2 fpull2 122.625 -10.875 3.125 -3.125 > confint(model2) 2.5 % 97.5 % (Intercept) 120.556801 124.693199 ften2 -12.943199 -8.806801 fstop2 1.056801 5.193199 fpull2 -5.193199 -1.056801

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
> tapply(distance,ften,mean) 1 2 122.625 111.750 > tapply(distance,fstop,mean) 1 2 115.625 118.750
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

Rforch24 - R Material for Chapter 24 > data.catapult...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online