Sunday, October 28, 2007

Power and Sample Size for one-way ANOVA

### Power and Sample Size for one-way ANOVA

# Alternative Situation:
among 4 means, 2 are the same
the smallest is delta/2 smaller
the largest is delta/2 bigger

# Sample Size

sample_size <- function(n, beta){
K<-4
delta<-20
sigma<-60
alpha<-0.05

# critical value
f <- qf(0.95,K-1,n*(K-1))

# noncentrality parameter
ncp <- n*delta^2/(2*K*sigma^2)

# Pr{ F(ncp) < f } - beta
pf(f,K-1,n*(K-1),ncp) - beta
}


# sample size satisfying power = 1-beta
uniroot(sample_size, c(10,10000), beta=0.2)$root

1 comment:

Anonymous said...

Sands Casino, LLC in Thunder Bay - Shootercasino
Thunder Bay Casino in Thunder Bay, Oklahoma. Our casino is conveniently situated near Thunder bk8 Bay Convention Center. 제왕카지노 It is close 샌즈카지노 to the Thunder Bay Convention Center