# with standardized coefficients
## statistical power
pwrss.z.med(a = 0.25, b = 0.25, cp = 0.10,
alpha = 0.05, n = 200, mc = TRUE)
## minimum required sample size
pwrss.z.med(a = 0.25, b = 0.25, cp = 0.10,
alpha = 0.05, power = 0.80)
## adjust for covariates in the outcome model
pwrss.z.med(a = 0.25, b = 0.25, cp = 0.10,
r2y.mx = 0.50,
alpha = 0.05, power = 0.80)
# with binary predictor X such as treatment/control variable
# in this case standardized coefficients for path a and cp would be Cohen's d values
## statistical power
p <- 0.50 # proportion of subjects in one group
pwrss.z.med(a = 0.40, b = 0.25, cp = 0.10,
sdx = sqrt(p*(1-p)),
alpha = 0.05, n = 200, mc = TRUE)
## minimum required sample size
pwrss.z.med(a = 0.40, b = 0.25, cp = 0.10,
sdx = sqrt(p*(1-p)),
alpha = 0.05, power = 0.80)
## adjust for covariates in outcome model
pwrss.z.med(a = 0.40, b = 0.25, cp = 0.10,
r2y.mx = 0.50, sdx = sqrt(p*(1-p)),
alpha = 0.05, power = 0.80)
Run the code above in your browser using DataLab