# NOT RUN {
score.obj <- inspect.score(rnorm(10000), cutoff = 0)
power.bcrd3r2(score.obj, order = 2,
es = 0.25, rho2 = .20, rho3 = .10, omega3 = .30,
g3 = 0, r2t3 = 0, n1 = 20, n2 = 3, n3 = 50)
# with 5 blocks df = n3- 2*(n blocks) - g3
# n3: number of level 3 units across five blocks
# increase in power rate due to r2t3 is made up for by reduction in df
power.bcrd3r2(score.obj, order = 2, df = 50 - 2*5 - 0,
es = 0.25, rho2 = .20, rho3 = .10, omega3 = .30,
g3 = 0, r2t3 = .30, n1 = 20, n2 = 3, n3 = 50)
# optimal combination of sample sizes for level 1, level 2, and level 3
# that produce power = .80 (given range restrictions for level 1 and level 2)
cosa.bcrd3r2(score.obj, order = 2,
constrain = "power", power = .80,
es = 0.25, rho2 = .20, rho3 = .10, omega3 = .30,
g3 = 0, r2t3 = 0,
n1 = c(10, 30), n2 = c(2, 5), n3 = NULL)
# }
Run the code above in your browser using DataLab