# NOT RUN {
## defining the range of n and theta to be evaluated
psi <- powPar(n = seq(from = 20, to = 60, by = 2),
theta = seq(from = 0.5, to = 1.5, by = 0.05)
)
## defining a power-function
powFun <- function(psi){
return(power.t.test(n = n(psi)/2, delta = theta(psi), sig.level = 0.05)$power)
}
## evaluating the power-function for all combinations of n and theta
calc <- powCalc(psi, statistic = powFun)
## adding example at theta of 1 and power of 0.9
pow <- powEx(calc, theta = 1)
## drawing the power plot
plot(pow,
xlab = "Difference",
ylab = "Total Sample Size")
# }
Run the code above in your browser using DataLab