User Tools

Site Tools


Power for Simple Mediation via Sobel test


Consider a simple mediation model

$$m_i = a_0 + a*x_i + em_i$$ $$y_i = b_0 + b*m_i + c*x_i + ey_i$$

where $em_i \sim N(0, \sigma_{em}^2)$ and $ey_i \sim N(0, \sigma_{ey}^2)$. The mediation effect is $ab = a*b$.

The Sobel test statistic is

$$ Z = \frac{\hat{a}\hat{b}}{\hat{\sigma}_{ab}} $$

where $ \hat{\sigma}_{ab}^2 = \hat{a}^2 * \hat{\sigma}_b^2 + \hat{b}^2 * \hat{\sigma}_a^2$. From regression analysis, we have

$$\hat{\sigma}_a^2 = \frac{\sigma_{em}^2}{n\sigma_x^2} $$

$$\hat{\sigma}_b^2 = \frac{\sigma_{ey}^2}{n\sigma_m^2(1-\rho_{mx}^2)} $$

Furthermore, because $\hat{a} = \rho_{xm}* \sigma_m/\sigma_x$, we have $\rho_{xm} = \hat{a} \sigma_x/\sigma_m$ and $\sigma_{em}^2 = \sigma_m^2(1-\rho_{mx}^2)=\sigma_m^2 - a^2 \sigma_x^2$. Then

$$\hat{\sigma}_a^2 = \frac{\sigma_m^2 - a^2 \sigma_x^2}{n\sigma_x^2} $$

$$\hat{\sigma}_b^2 = \frac{\sigma_{ey}^2}{n(\sigma_m^2 - a^2 \sigma_x^2)} $$

Therefore, the Sobel test depends on the sample size, the coefficients a and b, the variances of x and m as well as their correlation, and the residual variance of y denoted by $\hat{\sigma}_{ey}^2$ as in

$$ Z = \frac{\hat{a}\hat{b}}{ \sqrt{ \hat{a}^2 * \frac{\sigma_{ey}^2}{n(\sigma_m^2 - a^2 \sigma_x^2)} + \hat{b}^2 * \frac{\sigma_m^2 - a^2 \sigma_x^2}{n\sigma_x^2} }}$$

To calculate power, one need to provide information on (1) sample size, (2) coefficient $a$, (3) coefficient $b$, (4) variance of x ($\sigma_x^2$), (5) variance of m ($\sigma_m^2$), (6) error variance for y ($\sigma_{ey}^2$), and (7) the significance level $\alpha$. If the power is provided, the needed sample size can also be calculated.


Among (1) sample size, (2) coefficient $a$, (3) coefficient $b$, (4) variance of x ($\sigma_x^2$), (5) variance of m ($\sigma_m^2$), (6) error variance for y ($\sigma_{ey}^2$), (7) the significance level $\alpha$, and (8) power, one and only one can be left blank.

Sample Size

Provide the number of observations per group. Multiple sample sizes can be provided in two ways. First, multiple sample sizes can be supplied separated by white spaces, e.g., 100 150 200 will calculate power for the three sample sizes. A sequence of sample sizes can be generated using the method s:e:i with s denoting the starting sample size, e as ending sample size, and i as the interval. For example, 100:150:10 will generate a sequence 100 110 120 130 140 150.

By default, the sample size is 100.

Paths a and b

The paths in the model.

Variances of x and m

The marginal variances for x and m.

Error Variance of y

The variance of the error or residual $\sigma_{ey}^2$

Significance Level (alpha)

The significance level (Type I error rate) for power calculation withe the default 0.05.


The power of the test.

Power curve

Whether to generate the power curve.


A note (less than 200 characters) can be provided to provide basic information on the analysis.


The output lists the related information about this power analysis. The output is given as a matrix.

   N Power   a   b varx varm varey alpha
 100 0.802 0.4 0.4    1    1     1  0.05




manual/mediation01.txt · Last modified: 2015/11/19 16:33 by