power.z.mediation | R Documentation |
Calculates power or sample size (only one can be NULL at a time) to test indirect effects in a mediation model (Z-Test, Joint Test, and Monte Carlo Interval Test). One can consider explanatory power of the covariates in the mediator and outcome model via specifying R-squared values accordingly. power.z.mediation()
and power.z.med()
are the same functions.
NOTE: The function pwrss.z.mediation()
(or its alias pwrss.z.med()
) are no longer supported. However, they will remain available as wrappers for the power.z.mediation
function.
Formulas are validated using Monte Carlo simulation.
power.z.mediation(beta.a, beta.b, beta.cp = 0,
sd.predictor = 1, sd.mediator = 1, sd.outcome = 1,
r.squared.mediator = beta.a^2 * sd.predictor^2 / sd.mediator^2,
r.squared.outcome = (beta.b^2 * sd.mediator^2 +
beta.cp^2 * sd.predictor^2) / sd.outcome^2,
n = NULL, power = NULL, alpha = 0.05,
alternative = c("two.sided", "one.sided"),
method = c("sobel", "aroian", "goodman",
"joint", "monte.carlo"),
n.simulation = 1000,
n.draws = 1000,
ceiling = TRUE,
verbose = TRUE,
pretty = FALSE)
beta.a |
regression coefficient for X -> M path. One can use standardized regression coefficient, but should keep |
beta.b |
regression coefficient for M -> Y path. One can use standardized regression coefficient, but should keep |
beta.cp |
regression coefficient for X -> Y path (the direct path). One can use standardized regression coefficient, but should keep |
sd.predictor |
standard deviation of the predictor (X). For a binary predictor, |
sd.mediator |
standard deviation of the mediator (M). |
sd.outcome |
standard deviation of the outcome (Y). |
r.squared.mediator |
R-squared value for the mediator model (M ~ X). The default is |
r.squared.outcome |
R-squared value for the outcome model (Y ~ M + X). The default is |
n |
integer; sample size. |
power |
statistical power, defined as the probability of correctly rejecting a false null hypothesis, denoted as |
alpha |
type 1 error rate, defined as the probability of incorrectly rejecting a true null hypothesis, denoted as |
alternative |
character; direction or type of the hypothesis test: "two.sided" or "one.sided". |
method |
character; "sobel", "aroian", "goodman", "joint" or "monte.carlo". "joint" and "monte.carlo" methods cannot be used for sample size calculation. |
n.simulation |
integer; number of replications (applies when method = "monte.carlo"). |
n.draws |
integer; number of draws from the distribution of the path coefficients for each replication (applies when method = "monte.carlo"). |
ceiling |
logical; whether sample size should be rounded up. |
verbose |
logical; whether the output should be printed on the console. |
pretty |
logical; whether the output should show Unicode characters (if encoding allows for it). |
parms |
list of parameters used in calculation. |
test |
type of the statistical test ("Z-Test", "Joint Test", or "Monte Carlo Interval Test"). |
mean |
mean of the alternative distribution. |
sd |
standard deviation of the alternative distribution. |
null.mean |
mean of the null distribution. |
null.sd |
standard deviation of the null distribution. |
z.alpha |
critical value(s). |
power |
statistical power |
n |
sample size. |
Aroian, L. A. (1947). The probability function of the product of two normally distributed variables. Annals of Mathematical Statistics, 18(2), 265-271.
Goodman, L. A. (1960). On the exact variance of products. Journal of the American Statistical Association, 55(292), 708-713.
MacKinnon, D. P., & Dwyer, J. H. (1993). Estimating mediated effects in prevention studies. Evaluation Review, 17(2), 144-158.
MacKinnon, D. P., Warsi, G., & Dwyer, J. H. (1995). A simulation study of mediated effect measures. Multivariate Behavioral Research, 30(1), 41-62.
Preacher, K. J., & Hayes, A. F. (2004). SPSS and SAS procedures for estimating indirect effects in simple mediation models. Behavior Research Methods, Instruments, & Computers, 36, 717-731.
Preacher, K. J., & Hayes, A. F. (2008). Asymptotic and resampling strategies for assessing and comparing indirect effects in multiple mediator models. Behavior Research Methods, 40, 879-891.
Sobel, M. E. (1982). Asymptotic intervals for indirect effects in structural equations models. In S. Leinhart (Ed.), Sociological methodology 1982 (pp. 290-312). Jossey-Bass.
# with standardized coefficients
## statistical power
power.z.mediation(beta.a = 0.25,
beta.b = 0.25,
beta.cp = 0.10,
n = 200)
## minimum required sample size
power.z.mediation(beta.a = 0.25,
beta.b = 0.25,
beta.cp = 0.10,
power = 0.80)
## adjust for covariates in the outcome model
power.z.mediation(beta.a = 0.25,
beta.b = 0.25,
beta.cp = 0.10,
r.squared.outcome = 0.50,
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
power.z.mediation(beta.a = 0.40,
beta.b = 0.25,
beta.cp = 0.10,
sd.predictor = sqrt(p*(1-p)),
n = 200)
## minimum required sample size
power.z.mediation(beta.a = 0.40,
beta.b = 0.25,
beta.cp = 0.10,
sd.predictor = sqrt(p*(1-p)),
power = 0.80)
## adjust for covariates in the outcome model
power.z.mediation(beta.a = 0.40,
beta.b = 0.25, beta.cp = 0.10,
r.squared.outcome = 0.50,
sd.predictor = sqrt(p*(1-p)),
power = 0.80)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.