pwr.mdn: Power and Sample Size for Mediation Analysis

Description Usage Arguments Details Value Author(s) References Examples

View source: R/pwr_mdn.R

Description

pwr.mdn Compute power of tests related to mediation analysis or sample size to achieve desired power.

Usage

1
pwr.mdn(a, b, c.p, tau1, tau2, n = NULL, power = NULL, alpha = 0.05)

Arguments

a

specified value for coefficient a

b

specified value for coefficient b

c.p

specified value for coefficient c'

tau1

specified value of the ratio of residual variance of mediator M to the variance of the treatment X

tau2

specified value of the ratio of residual variance of outcome Y to the variance of the treatment X

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=1-a^2 and τ_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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

iMediate documentation built on May 2, 2019, 4:32 a.m.