Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I don't find a textbook presenting prediction intervals for mixed models. Moreover I'm only looking for a prediction interval for the balanced one-way random effect ANOVA model. Do you know a formula for this interval ?

share|improve this question
Why didn't you post your updates as an answer? Are you waiting for other replies? – chl Oct 25 '12 at 21:58
@chl I don't know whether this is a good practice for stats.stackexchange.. ? – Stéphane Laurent Oct 26 '12 at 5:01
Yes, it is. See, e.g., Etiquette for answering your own question, What is this “answer your own question” jazz?, or our Meta for a recent discussion. – chl Oct 26 '12 at 7:52
@chl Ok - done. – Stéphane Laurent Oct 26 '12 at 8:01

1 Answer

up vote 2 down vote accepted

I have now find some answers in Lin & Liao's paper.

I have applying method 2 (the one using Satterwaithe degrees of freedom) for the one-way random effect ANOVA. Below is the R code. I have checked with some simulations that it works quite well.

ranovapred <- function(y, group, conf=0.95){
    group <- factor(group)
    means <- aggregate(y~group, FUN=mean)$y  # groups means
    I <- length(levels(group))
    J <- length(y)/I
    sizes <- table(group) # groups sizes
    if(!all(as.numeric(sizes)==J)){ stop("balanced only!") }
    ssw <- crossprod(y-rep(means, times=sizes))  # within sum of squares
    ssb <- J*crossprod(means-mean(y)) # between sum of squares
    a <- (1/J*(1+1/I))/(I-1)
    b <- 1/I/J 
    v <- a*ssb+b*ssw # estimates the variance of (Ynew-Ybar)
    nu <- v^2/((a*ssb)^2/(I-1)+(b*ssw)^2/I/(J-1)) # Satterthwaite degrees of freedom
    alpha <- 1-conf
    bounds <- mean(y) + c(-1,1)*sqrt(v)*qt(1-alpha/2,nu)
return(bounds)
}

# test using simulated data
I <- 7 # number of groups
J <- 10 # number of replicates per group
mu <- 0 # overall mean
sigmab <- 1 # between standard deviation
sigmaw <- 1 # within standard deviation
group <- LETTERS[gl(I,J)] # factor levels
x <- c(sapply(rnorm(I,mu,sigmab), function(mui) rnorm(J, mui, sigmaw))) # responses
ranovapred(y=x, group=group)

Enjoy.

EDIT: By the way I have compared with SAS prediction intervals... these ones are totally wrong. It's frightening that some SAS customers build engines for aircraft ;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.