hw3a - Solutions to Assignment 3 Stat 512, Spring 2010 >...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions to Assignment 3 Stat 512, Spring 2010 1. (a) > # read in data > FabricShrink <- read.table("FabricShrink.txt", header=T) > # change fabric and temp to factors and plot > FabricShrink$fabric <- factor(FabricShrink$fabric) > FabricShrink$temp <- factor(FabricShrink$temp) > plot( y ~ fabric, data=FabricShrink) > plot( y ~ temp, data=FabricShrink) 1 2 3 4 2 4 6 8 10 12 fabric y We see some differences in shrinkage among the fabrics. 210 215 220 225 temp Percent shrinkage increases with temperature in a curvilinear fashion. The variance of the response appears to increase with the mean, so the errors are not homoscedastic.
Background image of page 1

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

View Full DocumentRight Arrow Icon
(b) > # apply effect coding and fit the two-way ANOVA model > contrasts(FabricShrink$fabric) <- contr.sum > contrasts(FabricShrink$temp) <- contr.sum > result <- lm( y ~ fabric*temp, data=FabricShrink) > summary(result) Call: lm(formula = y ~ fabric * temp, data = FabricShrink) Residuals: Min 1Q Median 3Q Max -3.000e-01 -1.125e-01 -1.388e-17 1.125e-01 3.000e-01 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.66875 0.03953 143.409 < 2e-16 *** fabric1 -1.54375 0.06847 -22.548 1.50e-13 *** fabric2 -0.31875 0.06847 -4.656 0.000264 *** fabric3 1.64375 0.06847 24.009 5.63e-14 *** temp1 -3.00625 0.06847 -43.909 < 2e-16 *** temp2 -2.13125 0.06847 -31.129 9.59e-16 *** temp3 0.48125 0.06847 7.029 2.85e-06 *** fabric1:temp1 0.83125 0.11859 7.010 2.95e-06 *** fabric2:temp1 -0.04375 0.11859 -0.369 0.717015 fabric3:temp1 -1.30625 0.11859 -11.015 7.04e-09 *** fabric1:temp2 0.05625 0.11859 0.474 0.641665 fabric2:temp2 0.88125 0.11859 7.431 1.42e-06 *** fabric3:temp2 -0.58125 0.11859 -4.902 0.000160 *** fabric1:temp3 0.19375 0.11859 1.634 0.121812 fabric2:temp3 -0.33125 0.11859 -2.793 0.013019 * fabric3:temp3 0.75625 0.11859 6.377 9.17e-06 *** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2236 on 16 degrees of freedom Multiple R-squared: 0.9977, Adjusted R-squared: 0.9955 F-statistic: 455.6 on 15 and 16 DF, p-value: < 2.2e-16 > anova(result) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) fabric 3 41.876 13.959 279.175 5.048e-14 *** temp 3 283.936 94.645 1892.908 < 2.2e-16 *** fabric:temp 9 15.856 1.762 35.236 7.094e-09 *** Residuals 16 0.800 0.050 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 From the ANOVA table, we see that the interactions fabric:temp are highly signifi- cant, so the effects of these two factors are not additive.
Background image of page 2
(c) > # compute the means for each temp and plot > Ybar.j. <- tapply( FabricShrink$y, FabricShrink$temp , mean) > plot(1:4, Ybar.j., type="l") 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4 6 8 10 1:4 Ybar.j. One way to find the contrast SS’s is to compute them yourself. yourself. Orthogonal polynomial contrast scores for a four-level factor are: linear: - 3 - 1 1 3 quadratic: 1 - 1 - 1 1 cubic: - 1 3 - 3 1 > # define contrast weights > c1 <- c(-3,-1,1,3) > c2 <- c(1,-1,-1,1) > c3 <- c(-1,3,-3,1) > # compute estimated contrasts and SS’s > a <- 4
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/19/2012 for the course STAT 512 taught by Professor John during the Spring '11 term at Peru State.

Page1 / 11

hw3a - Solutions to Assignment 3 Stat 512, Spring 2010 &gt;...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online