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 aa

b

specified value for coefficient bb

c.p

specified value for coefficient cc'

tau1

specified value of the ratio of residual variance of mediator MM to the variance of the treatment XX

tau2

specified value of the ratio of residual variance of outcome YY to the variance of the treatment XX

n

the sample size available. Either "n" or "power" must be provided

power

a value specifying the desired power. Either "n" or "power" must be provided

alpha

specified significance level

Details

This model is for the basic three-factor model. If coefficients are standardized, then τ1=1a2\tau_1=1-a^2 and τ2=1(c)2b22abc\tau_2=1-(c')^2-b^2-2abc'.

Value

A 2×52\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)


[Package iMediate version 0.5.5 Index]