# expected power for non-inferiority test of a 2x2 crossover
# CV 30\% known from a pilot study with 12 subjects (-> dfCV=10)
# using all the defaults for other parameters
# should give: [1] 0.6761068
exppower.noninf(CV=0.3, dfCV=10, n=40)
# Julious approximation
exppower.noninf(CV=0.3, dfCV=10, n=40, method="approx")
# should give: [1] 0.6751358
# Compare this to the usual power (CV assumed known, "carved in stone")
power.noninf(CV=0.3, n=40)
# should give: [1] 0.7228685
# same as 'expected' power with dfCV=Inf
exppower.noninf(CV=0.3, dfCV=Inf, n=40)
# may also calculated via exppower.TOST() after setting upper acceptance limit
# to Inf and alpha=0.025: settings of first example above
exppower.TOST(CV=0.3, dfCV=10, n=40, theta2=Inf, alpha=0.025)
Run the code above in your browser using DataLab