Stat 511
Homework 5 Solution
Spring 2011
Due: 11am, Monday Feb 14
1. This problem was set to reinforce a point made in lecture about power of various tests in an
ANOVA. Consider a study with 4 treatments in a 2 x 2 factorial. The investigators tell you
that 1.2 units is an important di±erence and the error variance is 1.0. You consider a design
with
n
= 6 observations for each treatment (i.e. a total of 24 observations).
To answer this question, we will still employ the R program ’power.r’
power <- function(n, c, means, sigma2){
xpx <- diag(rep(n,m))
# x’x matrix, m trt levels
cb <- c %*% means
ncp <- t(cb) %*% solve(c %*% ginv(xpx) %*% t(c)) %*% cb / sigma2;
q <- dim(c)[1]
# # rows in C
df <- m*(n-1)
# error df
pf(qf(0.95,q,df), q, df, ncp=ncp, lower=F)
# P[F(ncp) > crit ]
}
(a) Calculate the power of the test of the A main e±ect when the population A e±ect is 1.2.
cm1 <- t( c(0.5, 0.5, -0.5, -0.5) )
# t() is so have a row vector
means1 <- c(101.2,101.2,100,100)
# chosen so cb = 1.2
power(6,cm1,means1,1)
[1] 0.798381
(b) Calculate the power of the test of the A*B interaction when the population interaction,
(
μ
11
−
μ
12
)
−
(
μ
21
−
μ
22
), is 1.2.
cm2 <- t( c(1, -1, 1, -1) ) means2 <- c(1,0.8,1,0)
power(6,cm2,means2,1)
[1] 0.2879725
The investigators increase factor B to 3 levels, so there are 6 treatments in a 2 x 3 factorial.
Again, they consider
n
= 6 observations for each treatment (i.e. a total of 36 observations
now).
(c) Calculate the power of the test of the di±erence between level 1 of B and level 2 of B,
both averaged over levels of A, when the population di±erence is 1.2.
cm1 <- t( c(0.5, 0.5,0, -0.5, -0.5,0) )
means1 <- c(101.2,101.2,100,100,100,100)
power(6,cm1,means1,1)
[1] 0.8117006
(d) Calculate the power of the test of the A main e±ect when the population A e±ect is 1.2.
1