pwr.mdn {iMediate} | R Documentation |
Power and Sample Size for Mediation Analysis
Description
pwr.mdn
Compute power of tests related to mediation analysis or sample size to achieve desired power.
Usage
pwr.mdn(a, b, c.p, tau1, tau2, n = NULL, power = NULL, alpha = 0.05)
Arguments
a |
specified value for coefficient |
b |
specified value for coefficient |
c.p |
specified value for coefficient |
tau1 |
specified value of the ratio of residual variance of mediator |
tau2 |
specified value of the ratio of residual variance of outcome |
n |
the sample size available. Either |
power |
a value specifying the desired power. Either |
alpha |
specified significance level |
Details
This model is for the basic three-factor model. If coefficients are standardized, then \tau_1=1-a^2
and \tau_2=1-(c')^2-b^2-2abc'
.
Value
A 2\times 5
matrix
Author(s)
Kai Wang <kai-wang@uiowa.edu>
References
Wang, K. (2018) Understanding power anomalies in mediation analysis. Psychometrika 83 (2), 387-406.
Examples
n = 100
X = rnorm(n)
s2X = mean((X-mean(X))^2)
a=0.3
b=0.3
c.p = a*b
pwr.mdn(a, b, c.p, 1/s2X, 1/s2X, alpha=0.05, power=0.8)
pwr.mdn(a, b, c.p, 1/s2X, 1/s2X, alpha=0.05, n=200)
## Using standardized coefficients
pwr.mdn(a, b, c.p, 1-a^2, 1-c.p^2-b^2-2*a*b*c.p, alpha=0.05, power=0.8)
pwr.mdn(a, b, c.p, 1-a^2, 1-c.p^2-b^2-2*a*b*c.p, alpha=0.05, n=200)