[R] Learning to do randomized block design analysis

Zembower, Kevin kzembowe at jhuccp.org
Tue Dec 4 21:15:07 CET 2007


We just studied randomized block design analysis in my statistics class,
and I'm trying to learn how to do them in R. I'm trying to duplicate a
case study example from my textbook [1]:

> # Case Study 13.2.1, page 778
> cd <- c(8, 11, 9, 16, 24)
> dp <- c(2, 1, 12, 11, 19)
> lm <- c(-2, 0, 6, 2, 11)
>  table <- data.frame(Block=LETTERS[1:5], "Score changes"=c(cd, dp,
lm), Therapy=rep(c("Contact Desensitisztion", "Demonstration
Participation", "Live Modeling"), each=5))
> table
   Block Score.changes                     Therapy
1      A             8     Contact Desensitisztion
2      B            11     Contact Desensitisztion
3      C             9     Contact Desensitisztion
4      D            16     Contact Desensitisztion
5      E            24     Contact Desensitisztion
6      A             2 Demonstration Participation
7      B             1 Demonstration Participation
8      C            12 Demonstration Participation
9      D            11 Demonstration Participation
10     E            19 Demonstration Participation
11     A            -2               Live Modeling
12     B             0               Live Modeling
13     C             6               Live Modeling
14     D             2               Live Modeling
15     E            11               Live Modeling
> model.aov <- aov(Score.changes ~ Therapy + Error(Block), data=table)
> summary(model.aov)

Error: Block
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  4  438.0   109.5               

Error: Within
          Df Sum Sq Mean Sq F value   Pr(>F)   
Therapy    2 260.93  130.47  15.259 0.001861 **
Residuals  8  68.40    8.55                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
>

I don't understand why R doesn't output a value for F and Pr for the
Error (Block) dimension, as my textbook shows 12.807 and 0.0015
respectively. All the other numbers match. Can these two values be
recovered? Also, my text shows a total line which R omits. Is this
because it's not particularly useful?

Thanks for your suggestions and advice. Also, if I'm executing this type
of problem in R inefficiently, I'd appreciate suggestions.

-Kevin

[1] An Introduction to Mathematical Statistics and Its Applications,
Larsen and Marx, fourth edition.

Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland  21202
410-659-6139 



More information about the R-help mailing list