Replicated Latin Square Designs

Synthetic Yarn Example

> ### Replicated Latin Square Designs, Synthetic Yarn Data
> d <- c("A","B","C",  "B","C","A",  "C","A","B",
+        "B","C","A",  "A","B","C",  "C","A","B",
+        "C","A","B",  "A","B","C",  "B","C","A",
+        "A","B","C",  "B","C","A",  "C","A","B")
> s <- c(19.56,23.16,29.72,  22.94,27.51,23.71,  25.06,17.70,22.32,
+        23.24,23.54,18.75,  16.28,22.29,28.09,  18.53,19.89,20.42,
+        23.98,20.46,19.28,  15.33,23.02,24.97,  24.41,22.44,19.23,
+        16.65,22.69,24.94,  18.96,24.19,21.95,  21.49,15.78,24.65)
> yarn <- data.frame(strength=s, doff=gl(12,3),
+                    spinneret=gl(3,1,12), draw=factor(d))
> rm(d,s)
> save.image()
> summary( yarn.lm <- lm(strength ~ ., data=yarn) )

Call:
lm(formula = strength ~ ., data = yarn)

Residuals:
    Min      1Q  Median      3Q     Max 
-3.6814 -1.1478 -0.3643  1.5028  3.3428 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  19.7272     1.5144  13.027 3.14e-11 ***
doff2         0.5733     1.8547   0.309  0.76042    
doff3        -2.4533     1.8547  -1.323  0.20084    
doff4        -2.3033     1.8547  -1.242  0.22865    
doff5        -1.9267     1.8547  -1.039  0.31130    
doff6        -4.5333     1.8547  -2.444  0.02391 *  
doff7        -2.9067     1.8547  -1.567  0.13276    
doff8        -3.0400     1.8547  -1.639  0.11683    
doff9        -2.1200     1.8547  -1.143  0.26652    
doff10       -2.7200     1.8547  -1.467  0.15805    
doff11       -2.4467     1.8547  -1.319  0.20202    
doff12       -3.5067     1.8547  -1.891  0.07324 .  
spinneret2    1.3533     0.9274   1.459  0.16000    
spinneret3    2.6333     0.9274   2.840  0.01013 *  
drawB         3.5075     0.9274   3.782  0.00117 ** 
drawC         5.7642     0.9274   6.216 4.52e-06 ***
---
Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1

Residual standard error: 2.272 on 20 degrees of freedom
Multiple R-squared:  0.749,     Adjusted R-squared:  0.5608 
F-statistic: 3.979 on 15 and 20 DF,  p-value: 0.002355

> anova( yarn.lm )
Analysis of Variance Table

Response: strength
          Df  Sum Sq Mean Sq F value    Pr(>F)    
doff      11  63.884   5.808  1.1255   0.39277    
spinneret  2  41.617  20.809  4.0328   0.03377 *  
draw       2 202.483 101.241 19.6208 1.923e-05 ***
Residuals 20 103.198   5.160                      
---
Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1
> aov( yarn.lm )
Call:
   aov(formula = yarn.lm)

Terms:
                     doff spinneret      draw Residuals
Sum of Squares   63.88443  41.61742 202.48287 103.19817
Deg. of Freedom        11         2         2        20

Residual standard error: 2.271543
Estimated effects may be unbalanced
> ( yarn.tk <- TukeyHSD(aov(yarn.lm), "draw") )
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = yarn.lm)

$draw
        diff         lwr      upr     p adj
B-A 3.507500  1.16131217 5.853688 0.0032079
C-A 5.764167  3.41797884 8.110354 0.0000130
C-B 2.256667 -0.08952116 4.602854 0.0607262

> windows(width=5, height=5, pointsize=10)
> plot(yarn.tk, las=1)

The Tukey's HSD multiple comparison results are graphed:
(yarn01.png here)