# wp.mediation: Statistical Power Analysis for Simple Mediation In WebPower: Basic and Advanced Statistical Power Analysis

## Description

This function is for mediation models. Mediation models can be used to investigate the underlying mechanisms related to why an input variable x influences an output variable y (e.g., Hayes, 2013; MacKinnon, 2008). The mediation effect is calculated as a*b, where a is the path coefficent from the predictor x to the mediator m, and b is the path coefficent from the mediator m to the outcome variable y. Sobel test statistic (Sobel, 1982) is used to test whether the mediation effect is significantly different from zero.

## Usage

 ```1 2``` ```wp.mediation(n = NULL, power = NULL, a = 0.5, b = 0.5, varx = 1, vary = 1, varm = 1, alpha = 0.05) ```

## Arguments

 `n` Sample size. `power` Statistical power. `a` Coefficient from x to m. The default value is 0.5. `b` Coefficient from m to y. The default value is 0.5. `varx` Variance of x. The default value is 1. `vary` Variance of y. The default value is 1. `varm` Variance of m. The default value is 1. `alpha` significance level chosed for the test. It equals 0.05 by default.

## Value

An object of the power analysis.

## References

Hayes, A. F. (2013). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach. Guilford Press.

MacKinnon, D. P. (2008). Introduction to statistical mediation analysis. Routledge.

Sobel, M. E. (1982). Asymptotic confidence intervals for indirect effects in structural equation models. Sociological methodology, 13, 290-312.

Zhang, Z., & Yuan, K.-H. (2018). Practical Statistical Power Analysis Using Webpower and R (Eds). Granger, IN: ISDSA Press.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53``` ```#To calculate the statistical power given sample size and effect size: wp.mediation(n = 100, power = NULL, a = 0.5, b = 0.5, varx = 1, vary = 1, varm = 1, alpha = 0.05) # Power for simple mediation # # n power a b varx varm vary alpha # 100 0.9337271 0.5 0.5 1 1 1 0.05 # # URL: http://psychstat.org/mediation #To generate a power curve given a sequence of sample sizes: res <- wp.mediation(n = seq(50,100,5), power = NULL, a = 0.5, b = 0.5, varx = 1, vary = 1, varm = 1, alpha = 0.05) res # Power for simple mediation # # n power a b varx varm vary alpha # 50 0.6877704 0.5 0.5 1 1 1 0.05 # 55 0.7287681 0.5 0.5 1 1 1 0.05 # 60 0.7652593 0.5 0.5 1 1 1 0.05 # 65 0.7975459 0.5 0.5 1 1 1 0.05 # 70 0.8259584 0.5 0.5 1 1 1 0.05 # 75 0.8508388 0.5 0.5 1 1 1 0.05 # 80 0.8725282 0.5 0.5 1 1 1 0.05 # 85 0.8913577 0.5 0.5 1 1 1 0.05 # 90 0.9076417 0.5 0.5 1 1 1 0.05 # 95 0.9216744 0.5 0.5 1 1 1 0.05 # 100 0.9337271 0.5 0.5 1 1 1 0.05 # # URL: http://psychstat.org/mediation #To plot the power curve: plot(res) #To calculate the required sample size given power and effect size: wp.mediation(n = NULL, power = 0.9, a = 0.5, b = 0.5, varx = 1, vary = 1, varm = 1, alpha = 0.05) # Power for simple mediation # # n power a b varx varm vary alpha # 87.56182 0.9 0.5 0.5 1 1 1 0.05 # # URL: http://psychstat.org/mediation #To calculate the minimum detectable effect size of one coefficent given power and sample size: wp.mediation(n = 100, power = 0.9, a = NULL, b = 0.5, varx = 1, vary = 1, varm = 1, alpha = 0.05) # Power for simple mediation # # n power a b varx varm vary alpha # 100 0.9 0.7335197 0.5 1 1 1 0.05 # # URL: http://psychstat.org/mediation ```

WebPower documentation built on May 1, 2019, 8:19 p.m.