# sample size required to detect with 80% power a decreasing trend over 4 groups
# with 3:2:1:2 sample-size distribution at a 2.5% significance level
power.CA.test(power=0.8, pvec=c(0.4, 0.3, 0.2, 0.1), n.prop=c(3,2,1,2),
alternative = "less", sig.level=0.025)
# power of a 2-sided test to detect a logistic increase with slope 0.2 over 5 groups
# with groups of size 10 with unequal dose spacing
doses <- c(0,1,2,4,8)
p0 <- 0.05 # event probability at lowest dose
logit.props <- log(p0/(1-p0)) + doses * 0.2
p <- 1 / (1 + exp(-logit.props)) # hypothesized probabilities at each dose
power.CA.test(N = 10 * 5, pvec=p, scores = doses)
Run the code above in your browser using DataLab