Skip to main content
Biostatistics (Oxford, England) logoLink to Biostatistics (Oxford, England)
. 2017 Oct 26;19(4):514–528. doi: 10.1093/biostatistics/kxx054

A classical regression framework for mediation analysis: fitting one model to estimate mediation effects

Christina T Saunders 1,, Jeffrey D Blume 1
PMCID: PMC6180946  PMID: 29087439

SUMMARY

Mediation analysis explores the degree to which an exposure’s effect on an outcome is diverted through a mediating variable. We describe a classical regression framework for conducting mediation analyses in which estimates of causal mediation effects and their variance are obtained from the fit of a single regression model. The vector of changes in exposure pathway coefficients, which we named the essential mediation components (EMCs), is used to estimate standard causal mediation effects. Because these effects are often simple functions of the EMCs, an analytical expression for their model-based variance follows directly. Given this formula, it is instructive to revisit the performance of routinely used variance approximations (e.g., delta method and resampling methods). Requiring the fit of only one model reduces the computation time required for complex mediation analyses and permits the use of a rich suite of regression tools that are not easily implemented on a system of three equations, as would be required in the Baron–Kenny framework. Using data from the BRAIN-ICU study, we provide examples to illustrate the advantages of this framework and compare it with the existing approaches.

Keywords: Direct and indirect effect, Intermediate variable, Mediation analysis, Multiple mediators, Regression

1. Introduction

Mediators are behavioral, biological, psychological, or social constructs that transmit the effect of one variable to another. Mediation analysis seeks to understand how much of an exposure’s effect on an outcome is diverted through a mediating variable (Woodworth, 1928; Alwin and Hauser, 1975; Baron and Kenny, 1986). Background information on mediation analysis can be found in Baron and Kenny (1986), MacKinnon (2008), Hayes (2013), Preacher (2015), and VanderWeele (2015). Modern scientific investigations, such as genetic pathway analysis and disease prevention research, require a sophisticated framework for conducting mediation analysis.

The literature on mediation analysis is largely comprised of the approach popularized by Baron and Kenny (1986), the causal inference framework (Robins and Greenland, 1992; Pearl, 2001; Imai and others, 2010; VanderWeele, 2015), and the structural equation modeling approach Gunzler and others, 2013. Having been cited over 70 000 times (Google Scholar), the Baron–Kenny causal steps approach is ubiquitous in the social sciences and considered to be a cornerstone of mediation analysis. However, a growing technical literature has pointed out its inability to handle complex mediation hypotheses (MacKinnon and others, 2002; Fritz and MacKinnon, 2007; Preacher and Hayes, 2008; Zhao and others, 2010; Hayes, 2013).

Here, we propose a classical regression framework for conducting mediation analysis with linear models. We introduce the essential mediation components (EMCs), a general form for the difference in the exposure pathway coefficients. A formula for the EMCs and their model-based variance are derived from the fit of a single well-specified regression model. For the simple mediation model, the indirect effect for a unit change in the exposure is mathematically equivalent to the EMC; in general, however, causal mediation estimands (e.g., portion eliminated [PE] and natural indirect effect [NIE]) and their variance are functions of the EMCs, a critical distinction. A closed-form expression for the variance is a welcome advance of the framework, eliminating the need for delta method or resampling approximations.

This approach extends to settings with multiple mediators, interactions, and nonlinearities. Fitting a single model allows for a clean application of regression tools (e.g., imputation of missing data, cross-validation, and penalized likelihood methods) that are not easily implemented in a system of three equations. In a series of examples using data from the BRAIN-ICU study (Pandharipande and others, 2013), we illustrate our method and compare it with the existing regression-based approaches. Note that for space considerations, this article focuses on the setting of continuous outcomes (i.e., linear models). Extensions to the generalized linear model framework are in progress.

2. Background and notation

2.1. The simple mediation model

Mediation analyses generally seek to partition the total effect of an exposure into its direct and indirect components. For exposure Inline graphic, continuous mediator Inline graphic, and continuous outcome Inline graphic, the classic Baron–Kenny simple mediation model is illustrated in Figure 1 and represented by the following three regression equations. Errors are assumed to be normally distributed.

Fig. 1.

Fig. 1.

Simple mediation model for exposure Inline graphic, continuous mediator Inline graphic, and continuous outcome Inline graphic. The coefficients Inline graphic and Inline graphic are estimated from the system of three regression equations.

graphic file with name M9.gif (2.1)
graphic file with name M10.gif (2.2)
graphic file with name M11.gif (2.3)

The estimated total and direct effects for a unit change in Inline graphic are Inline graphic and Inline graphic, respectively. The indirect effect of Inline graphic is commonly estimated using the difference of coefficients, Inline graphic, or the product of coefficients, Inline graphic. For the simple mediation model, the two approaches agree and the total effect of Inline graphic on Inline graphic is the sum of the direct and indirect effects: Inline graphic. To infer causality, one must assume the relevant confounders (enumerated in Figure 2) have been accounted for (VanderWeele, 2015). Although the original Baron–Kenny model did not include covariates, we emphasize the importance of adjusting for confounders of the type listed in Figure 2, so that mediation effects are identifiable. One can simply add the set of relevant confounders to each model. Furthermore, the simple mediation model assumes linear relationships and no interaction among the variables, an assumption that can be relaxed. As in any scientific investigation, the assumed causal relationships in a mediation model rely on theory and empirical evidence.

Fig. 2.

Fig. 2.

Assumptions required for estimating causal mediation effects from a model with exposure Inline graphic, mediator Inline graphic, and outcome Inline graphic. Inline graphic represents confounding variables of the Inline graphic relationship, Inline graphic represents confounders of the Inline graphic relationship, and Inline graphic represents confounders of the Inline graphic relationship. To estimate causal mediation effects, the researcher assumes that he has controlled for Inline graphic and that there are no MInline graphicY confounders caused by Inline graphic. Identifying CDEs requires that assumptions (i) and (ii) be met. Identifying NDEs and NIEs requires that all four assumptions be met. Figure adapted from VanderWeele’s 2015 book Explanation in Causal Inference: Methods for Mediation and Interaction.

2.2. The difference of coefficients approach

There is disagreement as to whether the difference or product of coefficients approach is preferable (Alwin and Hauser, 1975; Preacher and Hayes, 2008; Imai and others, 2010). Although the two approaches agree for linear models, in general, they “represent legitimate intuitions in pursuit of two distinct causal quantities” and are not equivalent (Pearl, 2012b). In Section 3.1, we provide a general formula for the difference of coefficients approach (i.e., the PE), which seeks to evaluate the reduction in the total effect if indirect paths were blocked. This approach is recognized as being of great importance in public health policy research (Pearl, 2012a; VanderWeele, 2013; Naimi and others, 2014; VanderWeele, 2015). For example, when studying how an intervention can prevent adverse health outcomes, the difference of coefficients measures the maximum preventive effect of any such intervention on the mediating pathways (Pearl, 2012a; VanderWeele, 2015). Relevant quotes concerning the difference of coefficients approach and the PE are included in Appendix A of supplementary material available at Biostatistics online.

2.3. The causal inference framework for mediation analysis

The causal inference framework for mediation analysis defines mediation effects as contrasts in average potential outcomes (Holland, 1986; Robins and Greenland, 1992; Pearl, 2001). Let Inline graphic be the potential outcome that would be observed if the exposure Inline graphic were equal to Inline graphic and the mediator Inline graphic were equal to Inline graphic. Let Inline graphic be the potential outcome that would be observed if the exposure were equal to Inline graphic, but the mediator Inline graphic were equal to the value it would have been if the exposure was equal to Inline graphic. Note that the counterfactuals Inline graphic and Inline graphic can never be observed. Table 1 provides the counterfactual definitions of causal mediation effects. We use the Inline graphic notation to make explicit that causal mediation effects are defined for any two levels of the exposure. When Inline graphic is a binary variable, the only possible pair of values is Inline graphic.

Table 1.

Counterfactual definitions of causal mediation effects and the corresponding regression-based estimands obtained from the simple mediation model

Causal mediation effects The simple mediation model
Causal effect Potential outcome Regression estimand
CDE(Inline graphic) Inline graphic Inline graphic
NDE(Inline graphic) Inline graphic Inline graphic
TE(Inline graphic) Inline graphic Inline graphic
NIE(Inline graphic) Inline graphic Inline graphic
PE(Inline graphic) Inline graphic Inline graphic

The causal mediation literature distinguishes between controlled and natural effects. The controlled direct effect (CDE) measures the effect of Inline graphic on Inline graphic while holding the mediator fixed at level Inline graphic for everyone in the population. The natural direct effect (NDE) measures the effect of the exposure on the outcome when each individual’s mediator is fixed to Inline graphic, what it would have been “naturally” had the exposure been absent (or equal to some referent value). The NIE represents the difference in the outcome if one holds the exposure at level Inline graphic and changes the mediator from the value that would have been observed under the referent exposure, Inline graphic, to the value that would have been observed under treatment, Inline graphic. The NIE is the difference between the total effect and the NDE: Inline graphic. Another important quantity is the PE, which is the difference between the total effect and the CDE: Inline graphic (VanderWeele, 2015).

Pearl’s mediation formula (see Appendix B of supplementary material available at Biostatistics online) is a generalization of the product of coefficients approach and can be used to estimate the causal mediation effects from any type of model (Pearl, 2001; Imai and others, 2010; Pearl, 2012a). For illustrative purposes, Table 1 displays the regression estimand obtained from applying the mediation formula to the simple mediation model: Inline graphicInline graphic, and Inline graphic PE. In this simple case, the estimated effects are identical to those obtained in the Baron–Kenny approach for a unit change in the exposure.

2.4. Estimating the variance of mediation effects

Currently, estimating the variance of the indirect effect relies on approximations; a closed-form solution has not been discovered until now. Sobel’s (1982) delta method approximation for the variance of the product of coefficients is Inline graphic. Even though the sampling distribution of Inline graphic tends to be skewed and highly leptokurtic, inference procedures rely on a large sample normal approximation; as a result, Sobel confidence intervals (CIs) tend to lie to the left of the true value for positive indirect effects and to the right for negative indirect effects (Stone and Sobel, 1990; MacKinnon and others, 1995, 2004). VanderWeele has derived delta method variance approximations for more complex mediation models (2015). Bootstrapping handles asymmetric sampling distributions better than the delta method and thus improves the accuracy of confidence limits (Preacher and Hayes, 2008). Monte Carlo methods estimate the variance by simulating the sampling distribution of mediation effects (MacKinnon and others, 2004) and are implemented in the software by Imai and others (2010). Now that an analytical solution for the variance exists, it is of interest to re-examine the behavior of these approximations. Simulations in Section 5.2 shed light on these considerations and the efficiency gains inherent in avoiding conservative approximations.

3. A classical regression framework

We define an intermediate inferential target called the EMCs, which is the vector of changes in the exposure coefficients. Analytical estimates of the EMCs and their model-based variance are derived from the fit of a single regression model. Inference for causal mediation effects, which are functions of the EMCs, follows naturally. Furthermore, because the fit of only one model is required, it is straightforward to incorporate multiple mediators, exposure–exposure interactions, and mediator–mediator interactions.

3.1. The essential mediation components

Recall that the simple mediation model (2.12.3) assumes Inline graphic is linearly related to Inline graphic. A more general formulation allows the effect of Inline graphic to be nonlinear: Inline graphic, where Inline graphic is a flexible function of Inline graphic (e.g., Inline graphic). For Inline graphic exposures Inline graphic and Inline graphic mediators Inline graphic, the full model and its implied submodel are

graphic file with name M87.gif (3.1)
graphic file with name M88.gif (3.2)

where Inline graphic is a vector that captures the nonlinear trends in Inline graphic, such as a spline basis. We call the vector of differences Inline graphic the EMCs.

Using properties of the multivariate Gaussian distribution, we obtain estimates of the EMCs and their variance using functionals from the fitted full model (3.1). Under well-known conditions on the linear model, Inline graphic, where Inline graphic is the number of parameters in the full model. Without loss of generality, we consider a model with no intercept. Partition Inline graphic, where Inline graphic is the Inline graphic-vector of exposure coefficients and Inline graphic is the Inline graphic-vector of mediator coefficients such that

graphic file with name M99.gif

The conditional distribution of Inline graphic given Inline graphic is Inline graphic, where Inline graphic and Inline graphic. If Inline graphic, we obtain Inline graphic, where Inline graphic. Thus, a general formula for the difference in pathway coefficients Inline graphic, which we call the EMCs of Inline graphic, is

graphic file with name M110.gif (3.3)

This formula allows us to estimate multidimensional mediation effects (Inline graphic and Inline graphic can be multivariate) from a single regression model (3.1) rather than fitting separate models and aggregating effect estimates. Notice that for the simple mediation model (2.12.3), Inline graphic is exactly equal to the PE for a unit change in Inline graphic (which equals the causal NIE and the Baron–Kenny product of coefficients estimand). In general, when the exposure or mediator effects are nonscalar, the PE is a function of Inline graphic:

graphic file with name M116.gif (3.4)

Table 2 of supplementary material available at Biostatistics online provides a list of commonly encountered mediation models for which the controlled direct effects and natural direct effects are equivalent, and as a result, the PE and the NIE are the same. For these models, the NIE can be estimated using our formula: NIE(Inline graphic. We will consider the case of interactions in Section 3.5.

3.2. Illustration

To illustrate the relationship between the EMCs and causal mediation effects, consider the full model with a quadratic effect of the exposure, Inline graphic, so that the full model is given by Inline graphic, the model for Inline graphic is Inline graphic, and the submodel for the total effect of Inline graphic is Inline graphic. The CDE and NDE both equal Inline graphic, which are estimated from the full model. The EMCs Inline graphic and the NIE Inline graphic are functionals that can be estimated from components of the full model. Notice that the causal mediation effects depend on the choice of Inline graphic, while if Inline graphic is binary this reduces to Inline graphic.

Now suppose the full model includes an exposure–mediator interaction so that the full model is Inline graphic. The implied submodel is Inline graphic. The EMCs Inline graphic and the NIE is Inline graphic. For a unit change in Inline graphic, this reduces to Inline graphic. Notice that in both examples, the implied submodel Inline graphic has the same form. As a result, the total effects Inline graphic and Inline graphic would have the same empirical estimate even though the system of equations is different.

3.3. The conditional and the unconditional variance of the indirect effect

A closed-form expression for the fully conditional variance of the EMCs follows directly as Inline graphic. The variance of the NIE (and more generally, the PE) is trivial to obtain using Inline graphic, which requires fitting only one model (3.1). From properties of a regression model, for a scalar PE with a unit change in the exposure, we have Inline graphic and the 95% CI is Inline graphic -Inline graphic.

In equations (3.1) and (3.2), Inline graphic is a random variable and Inline graphic and Inline graphic are fixed covariates. One may wish to treat the mediator as a random variable and marginalize over Inline graphic. The causal inference framework uses the marginal variance for inference (VanderWeele, 2015). Using the law of total probability,

graphic file with name M148.gif (3.5)

where Inline graphic is the Inline graphic design matrix. This quantity can be estimated by plugging in the sample correlation Inline graphic, the maximum likelihood estimates of the variances of Inline graphic and Inline graphic, estimates of the mean square error of Inline graphic from (2.1) and of Inline graphic from (2.2), and Inline graphic. Notice that the second term in (3.5) is an increasing function of Inline graphic and a decreasing function of the sample size Inline graphic. We used simulations to empirically verify (3.5) under various sample sizes Inline graphic and magnitudes of Inline graphic. Although the second term in Var(Inline graphic requires estimating the variance of the residuals from the regression of Inline graphic on Inline graphic, the contribution is of order Inline graphic and becomes negligible in moderate sample sizes. The marginal variance of mediation effects follows.

Because the mediator is (in theory) a consequent of the exposure, Inline graphic cannot be randomized and one could argue in favor of treating both Inline graphic and Inline graphic as fixed (Pearl 2012a). In classical regression settings, the conditional variance is frequently used for inference even when the covariate changes in a population. As we note above, the distinction between the two variances becomes semantic in large samples. Which variance is to be preferred deserves consideration, but further discussion is beyond the scope of this article. Note that the nonparametric bootstrap, which samples with replacement from pairs of Inline graphic and Inline graphic, approximates the fully unconditional variance (marginalized over both exposure and mediator).

3.4. Multiple mediators

Suppose the exposure’s effect on the outcome is transmitted through several mediators. Estimating the total indirect effect in a multiple mediator model aims to determine whether the set of Inline graphic mediators Inline graphic transmits the effect of Inline graphic to Inline graphic. To identify the NDE and NIE from a multiple mediator model, all four no unmeasured confounding assumptions outlined in Figure 2 must hold with respect to Inline graphic. Existing approaches in the context of multiple mediators include the single-step multiple mediator model (MacKinnon, 2008), also termed the parallel multiple mediator model (Hayes, 2013), and the serial multiple mediator model (Hayes, 2013). The single-step approach specifies a separate outcome model for each mediator in which they independently affect the outcome (see Figure 3C). The serial model relies on assumptions about the directionality of the mediators, which can be unverifiable with cross-sectional data (see Figure 3B). VanderWeele and Vansteelandt (2013) provide both regression-based and weighting approaches that allow mediators to be interdependent (see Figure 3A). The simulation-based approach by Imai and others (2010) handles multiple mediator models of all types, but the software currently accommodates only two mediators, and the user must specify one mediator as “main” and the other as “alternative.”

Fig. 3.

Fig. 3.

Comparison of multiple mediator models. Model A depicts the proposed single-model framework for assessing mediation with multiple mediators. Model B depicts the serial multiple mediator model. Model C depicts the single-step or parallel multiple mediator model. The directions of arrows indicate the assumed causal pathways.

Within our framework, incorporating multiple mediators is simple and efficient. Our formulation allows the mediators to covary, a more realistic assumption than assuming the mediators do not affect each other (as is required for the single-step models) or that we know the order in which they affect each other (as is required for serial models). The advantage of using our approach is that it requires fitting only one model to obtain causal mediation estimands (compared with three or more models required by existing approaches), and it yields model-based variance estimates that do not require the computation time of resampling methods.

If we posit Inline graphic mediators such that the full mediation model is Inline graphic and the corresponding submodel for the total effect of Inline graphic is Inline graphic, then the total indirect effect through Inline graphic is estimated by Inline graphic -Inline graphic and its variance by Inline graphic. The mediator-specific indirect effect represents the ability of Inline graphic to mediate the effect of Inline graphic on Inline graphic above and beyond the other Inline graphic mediators. The specific indirect effect through Inline graphic is Inline graphic, which is easily estimated using -Inline graphic. The specific indirect effect through Inline graphic is estimated using -Inline graphic. The variance is estimated with Inline graphic. Importantly, formula 3.3 gives us these effects and their variances without having to fit any submodels.

If two or more mediators share a role in transmitting the effect of Inline graphic to Inline graphic, then the effect attributed to a specific mediator Inline graphic may exclude this overlapping effect. Additionally, specific indirect effects might have different signs, leading to inconsistent mediation. As a result, the specific indirect effects attributed to each mediator do not necessarily sum to the total indirect effect mediated by the set of mediators. We emphasize that the estimated total indirect effect through Inline graphic comes from the full model containing all of the mediators and does not suffer bias from the mis-specification of intermediator relationships. Thus, we recommend the researcher’s primary interest lie in the total indirect effect rather than the amount mediated by a specific mediator. We present relevant examples in Section 6.

The regression-based approach by VanderWeele and Vansteelandt (2013) uses one outcome model for all of the mediators but also requires a separate model for each mediator and each mediator–mediator interaction. Including covariates Inline graphic can lead to compatibility issues between the models for Inline graphic, Inline graphic, and their product Inline graphic. Their alternative inverse probability weighting approach circumvents this issue in settings with mediator–mediator interactions. The weighting approach allows the mediators to affect each other and does not require modeling the mediators, but it does require fitting several logistic regression models to estimate Inline graphic, Inline graphic, Inline graphic, Inline graphic for the weights. It should be noted that the weighting method performs best when the exposure has only a few levels (e.g., binary or discrete) (VanderWeele and Vansteelandt, 2013).

3.5. Interactions and moderated mediation

Our framework accommodates exposure–exposure and mediator–mediator interactions as well as interactions with confounders. Simply include the interaction terms of interest in the full model and use formulas 3.3 and 3.4 to estimate the EMCs and causal mediation effects. We now consider the more complex setting of exposure–mediator interactions (so-called moderated mediation).

The causal mediation literature often considers exposure–mediator interactions with binary Inline graphic, such that the full model is Inline graphic and the submodel is Inline graphic. The portion eliminated PE = TEInline graphicCDE(Inline graphic is estimated from the fit of the full model using Inline graphic. One could plot the PE as a function of Inline graphic or report the PE for a point of interest Inline graphic, such as the sample mean. Its variance follows by direct calculation: Inline graphic.

If the exposure is continuous, then the exposure–mediator interaction model above implies a marginal model that includes an Inline graphic term. In this case, the marginal model cannot be estimated using the single-model framework, because it is not nested within the full model. Our framework requires that the full model also include an Inline graphic term (see Section 3.2 for an example), which can be viewed as relaxing the assumption that all nonlinear effects of the exposure act through the mediator. In this sense, a broader full model is desirable. Despite the non-nested submodel, it is possible to use the mediation formula to proceed with estimation in this setting. Further thoughts are included in Remark D.

Notice that exposure–mediator interactions lead to mediation effects that are less clearly defined. Because Inline graphic acts simultaneously as a moderator and a mediator, both the direct and indirect effects are affected by Inline graphic. As a result, there is more than one way to decompose the total effect depending on how the interaction effect is accounted for (Robins and Greenland, 1992; Pearl, 2001). If one attributes Inline graphic to the indirect effect, then the total effect decomposes into the NDE and total indirect effect. Conversely, if one attributes Inline graphic to the direct effect, then the total effect decomposes into the total direct effect and pure indirect effect. Thus, mediation and moderation are “inextricably intertwined and cannot be assessed separately” (Pearl, 2012b).

With exposure–mediator interactions, the CDE and NDE diverge: CDE(Inline graphic) = Inline graphic and NDE = Inline graphic. Because the CDE is a function of Inline graphic, the PE and its variance are functions of the mediator as well. The NDE marginalizes over Inline graphic and is a function of the exposure that can be defined for any levels of Inline graphic (Naimi and others, 2014). The PE does not depend on the choice of decomposition, because it is the portion of the total effect attributed to both interaction and mediation. As such, the PE is a comprehensive estimate of moderated mediation in these complex settings.

4. Impact of omitted covariates on estimating the indirect effect

What happens to Inline graphic when we omit an important covariate in the specification of the full model? If the omitted covariate is orthogonal to Inline graphic or to Inline graphic, then Inline graphic does not incur additional bias. To fix ideas, consider the simple setting in which we have one exposure Inline graphic, one mediator Inline graphic, and a third omitted covariate Inline graphic. Suppose the true data-generating mechanism is Inline graphic, but we do not know Inline graphic so we incorrectly specify the full model as Inline graphic and the submodel as Inline graphic. The estimates Inline graphic and Inline graphic will be biased estimates of Inline graphic, the “true” effect of Inline graphic. The expected values of the parameters from the full model and submodel are Inline graphic and Inline graphic, respectively. Thus, when we omit Inline graphic, the expected difference in the estimated total and direct effects for a unit change in Inline graphic is Inline graphic.

Next, suppose that Inline graphic does not depend on Inline graphic and the true data-generating mechanism is Inline graphic. If we correctly specify the full model as Inline graphic and the submodel as Inline graphic, then Inline graphic. The bias in the estimated indirect effect when the full model omits Inline graphic is given by Inline graphic. As a result, if Inline graphic is orthogonal to Inline graphic or Inline graphic (Inline graphic) or Inline graphic (a trivial case), then the estimated indirect effect under the incorrectly specified full model is robust to mis-specification. That is, omitting Inline graphic will not change the estimate of the indirect effect.

Note that if Inline graphic is not orthogonal to either Inline graphic or Inline graphic such that Inline graphic is a confounder of the exposure–mediator relationship, then assumption (iii) of the no-unmeasured confounding assumptions is violated and so the NDE and NIE are not identifiable. The CDE is still identifiable in this setting, provided there are no unmeasured confounders of the exposure–outcome and mediator–outcome relationship (see Figure 2).

5. Simulations

5.1. Setup

We use simulations to provide empirical support for the proposed approach to mediation analysis with a simple mediation model. We simulated 5000 data sets of sample size Inline graphic with a “true” indirect effect of 1.5. The “true” full model was Inline graphic, where Inline graphic. The exposure Inline graphic and mediator Inline graphic, where Inline graphic. When comparing methods, 10 000 bootstrap replications and 10 000 Monte Carlo draws were used. For each replication, we computed each method’s estimated indirect effect and estimated variance and compared these with the true effect and the empirical (“true”) variance. The bias of the estimated indirect effect was captured when Inline graphic and Inline graphic were both fixed and when Inline graphic was random. These simulations demonstrate the performance of our formulas and are not intended to be exhaustive. Varying parameter values affected the magnitude of the results but not the general patterns.

5.2. How our variance measure compares with the existing measures

The results of estimating the variance of the indirect effect using the analytical regression-based formula, bootstrapping, Sobel’s formula, and Monte Carlo methods are shown in Figure 1 and Table 1 of supplementary material available at Biostatistics online. The analytical variance formula appears unbiased for the true variance. Sobel’s variance performs similarly to the case bootstrap. As expected, the estimated variance from bootstrapping cases is greater than that from the residual bootstrap (see Section 3.3). As the sample size increases, the variances of the estimates of Inline graphic from the cases bootstrap, Sobel’s formula, and the MC methods decrease but remain biased.

5.3. The bias of indirect effect estimates depends on the conditioning set

Under the full model, the expectation of Inline graphic is Inline graphic, where Inline graphic is the projection of Inline graphic onto Inline graphic. For the simple mediation model, Inline graphic. To estimate Inline graphic, we replace Inline graphic and Inline graphic with their sample estimates Inline graphic and Inline graphic to obtain Inline graphic, which is biased per Jensen’s inequality. This is not surprising, because the sample correlation Inline graphic is a biased estimate of Inline graphic, a result given by Fisher (1915): Inline graphic. Since Inline graphic and Inline graphic as Inline graphic, Inline graphic is biased but consistent for the true Inline graphic by the Law of Large Numbers and the Continuous Mapping Theorem.

The distributions of Inline graphic when Inline graphic and Inline graphic are both fixed and when Inline graphic varies are shown in Figure 2 of supplementary material available at Biostatistics online (note that Inline graphic equals the indirect effect for a unit change in Inline graphic from the simple mediation model). When Inline graphic and Inline graphic are both fixed, Inline graphic is biased as a function of the bias of Inline graphic. If we allow Inline graphic to vary, the bias is reduced because Inline graphic is no longer fixed and it tends to approximate Inline graphic better on average. Therefore, because of the bias–variance trade-off, coverage probability alone is not the proper performance measure when Inline graphic poorly approximates Inline graphic.

6. Examples with data from Vanderbilt ICU patients

We illustrate our method and existing approaches using data from a prospective cohort of 217 intensive care unit (ICU) patients at Vanderbilt University Medical Center with acute respiratory failure and/or cardiogenic or septic shock (Pandharipande and others, 2013). The goal is to examine the cognitive effects of critical illness. We use measurements of creatinine (mg/dL) and estimated glomerular filtration rate measured at baseline, benzodiazepine dose (mg), Sequential Organ Failure Assessment (SOFA) score, mental status (delirious or normal) assessed with the Confusion Assessment Method for the ICU and Richmond Agitation-Sedation Scale, and Repeatable Battery for the Assessment of Neuropsychological Status (RBANS), a global cognitive score measured three months post-discharge. Biomarker S100B levels were measured for 121 of these patients.

We present several simple examples of mediation models to illustrate the efficiency and coherence of our proposed framework. We compare variance estimates obtained from the model-based formula, Sobel’s formula, and percentiles of 10 000 bootstrap replications. The first two examples assume there are no unmeasured confounders, and the third assumes the covariate Inline graphic sufficiently controls for confounding. We do not intend for the examples and their results to be interpreted scientifically; rather, they are meant to illustrate the methods discussed throughout the article. All models assume errors Inline graphic. Unless otherwise specified, we compare unit changes in the exposure so that Inline graphic.

Example 1

(Simple mediation model) Does severity of illness (SOFA) mediate the effect of creatinine on S100B levels? We specify the full model as Inline graphic to estimate the EMC Inline graphic = -Inline graphic, where Inline graphic and Inline graphic. The mediated effect of creatinine on S100B is Inline graphic (SE = 7.12) with 95% 14.54, 42.74. The residual bootstrap SE = 7.06, Sobel’s SE = 17.25, and the case bootstrap SE = 18.74. Importantly, the model-based variance is five times smaller than Sobel’s and the case bootstrap, which yield 95% CIs that include zero. Although the residual bootstrap variance gives essentially the same answer as the model-based formula, the formula avoids the computation time and effort.

To allow for a quadratic relationship between creatinine and S100B, simply specify the full model as Inline graphic. The EMCs Inline graphic= -Inline graphic is now a vector of the linear and quadratic effects of creatinine. The PE (which equals the NIE) is 28.33Inline graphic. Using the mediation package gives an estimated NIE of 17.25 (exactly equal to our estimate, as expected) and requires 111.94 s of computation time compared to 0.01 s using our approach. In the remaining examples, we consider only linear effects but allowing for nonlinear relationships in practice is strongly advised and easily implemented within the proposed framework.

Example 2

(Simple mediation model where Sobel’s approximation holds) It is not always true that we see such large efficiency gains. For instance, our method yields similar results to standard approaches when we investigate whether the relationship between creatinine and overall cognitive function (RBANS) is mediated by severity of illness. The estimated indirect effect is 0.01 (SE = 0.27), the residual bootstrap SE = 0.27, Sobel’s SE = 0.27, and the case bootstrap SE = 0.29.

Example 3

(Exposure-confounder interactions) Recall that identifying mediation effects relies on a strict set of no unmeasured confounding assumptions (outlined in Figure 2). To keep this example simple, we assume that adjusting for Inline graphic = Charlson score is sufficient to satisfy these assumptions. We also include an exposure–confounder interaction, so that the full model is Inline graphic. The indirect effect marginalized over the confounder is EInline graphic. The variance is estimated using Inline graphic.

For a unit change in creatinine, the estimated indirect effect is 0.0028 (SE = 0.22). The regression-based approach by VanderWeele requires fitting the mediator model Inline graphic in addition to the full model. The mediation formula estimates the indirect effect using Inline graphic (SE = 0.24).

To examine the indirect effect comparing the 75th percentile to the median value of creatinine, one simply plugs in these values for Inline graphic and Inline graphic. Using the single-model approach took 0.02 s to estimate the total, direct, and indirect effects, and an additional 0.003 s to recalculate the indirect effect for the new pair of exposure values. Using the simulation-based mediation package required 24.89 s, and a new simulation must be run for each additional pair of exposure values. Although this difference may seem inconsequential for this simple example, using 3.3 and 3.4 reduces the computation time by several orders of magnitude when applied to big data. For example, with the current sample size (N = 217), if one were to study mediation across 10 000 SNPs and three different pairs of the exposure were of interest, the simulation-based approach would require around Inline graphic s (over 8 days) to run. The proposed approach would take Inline graphic s (under 4 min).

Example 4

(Multiple mediator model) Is the effect of creatinine on cognitive function mediated by severity of illness and benzodiazepine dose? The conceptual diagrams in Figure 3 depict the single-model approach for multiple mediators, the serial multiple mediator model, and the parallel multiple mediator model. For all three methods, the full model is Inline graphic and the submodel for the total effect of creatinine on cognitive function is Inline graphic. Thus, the direct effect of creatinine is Inline graphic, the total effect of creatinine is Inline graphic, and the total indirect effect of creatinine through SOFA and benzodiazepine is Inline graphic, regardless of which method you use. It is important to recognize that the total indirect effect does not depend on the order or directionality of the mediators, whereas the amount of mediation attributed specifically to SOFA or benzodiazepine will differ across methods due to their varying assumptions about intermediator relationships.

We estimate how much severity of illness and benzodiazepine dose mediate the relationship between creatinine and cognitive function using only the full model and formula 3.4. For Inline graphic and Inline graphic, the total indirect effect through Inline graphic is estimated using Inline graphic = -Inline graphic = Inline graphic0.34 and its empirical variance Inline graphic = 0.139 (SE = 0.37).

Now suppose we are interested in mediator-specific effects. Since we have already fit the full model, to estimate how much is mediated specifically through Inline graphic we simply apply 3.3: -Inline graphic = Inline graphic0.046. The variance follows directly: Inline graphic = 0.092 (SE = 0.30). Similarly, to estimate how much the effect of creatinine is mediated through Inline graphic = Inline graphic, use -Inline graphic = Inline graphic0.352, which has an estimated variance of Inline graphic (SE = 0.26). Keeping in mind SOFA is correlated with benzodiazepine dose, notice that the mediator-specific indirect effects sum to Inline graphic0.398, which does not equal the total indirect effect of Inline graphic0.34.

The parallel approach (MacKinnon, 2008; Hayes, 2013) and the causal regression-based approach (VanderWeele and Vansteelandt, 2013) specify the same full model as above Inline graphic and an additional model for each mediator: Inline graphic and Inline graphic. This specification assumes the mediators “act in parallel” (see Figure 3C). The estimated indirect effect through SOFA is Inline graphic = Inline graphic0.042 (SE = 0.27) and the estimated indirect effect through benzodiazepine is Inline graphic = Inline graphic0.299 (SE = 0.25), which sum to the total indirect effect. Delta method approximations are used to estimate standard errors. When the exposure is continuous and there are no mediator–mediator interactions, the weighting approach is not recommended (VanderWeele and Vansteelandt, 2013).

The serial model given by Hayes (2013) requires specifying the order in which the mediators affect each other. Suppose we assume Inline graphic (see Figure 3B1). The full model is specified as Inline graphic (the same as above), the first submodel is Inline graphic, and the second submodel is Inline graphic. There are three estimated indirect effects: Inline graphic = Inline graphic0.04 (SE = 0.27) is the indirect effect of creatinine through SOFA to RBANS, Inline graphic = Inline graphic0.35 (SE = 0.29) is the indirect effect of creatinine through benzodiazepine to RBANS, and Inline graphic = 0.05 (SE = 0.36) is the indirect effect of creatinine through SOFA to benzodiazepine to RBANS. The variances of Inline graphic and Inline graphic are estimated using Sobel’s formula and Inline graphic (Hayes, 2013).

To demonstrate how mediator-specific indirect effects depend on the specified order in a serial model, suppose we change the order of mediation to Inline graphic (see Figure 3B2). The total indirect effect remains unchanged, but now the indirect effect of creatinine through benzodiazepine to RBANS is Inline graphic0.299, the indirect effect of creatinine through SOFA to RBANS is Inline graphic0.046, and the indirect effect of creatinine through benzodiazepine to SOFA to RBANS is 0.0046. Notice that in either case, the serially mediated indirect effects sum to the total indirect effect. Estimating the indirect effects from the serial model is analogous to examining sequential sums of squares, whereas estimating effects from the proposed framework is analogous to examining partial sums of squares. Just as partial sums of squares do not necessarily sum to the total, mediator-specific indirect effects do not necessarily sum to the total indirect effect. In contrast, the serial indirect effects do sum to the total indirect effect, but their estimation depends heavily on the assumed order of the mediators.

7. Remarks

The statistical literature abounds with methods for estimating the indirect effect and its variance from the simple mediation model. For sophisticated mediation analyses involving interactions, splines, and any combination of continuous, binary, and categorical mediators, the proposed single-model approach is straightforward to implement.

Remark A: Straightforward application of modeling tools

The proposed framework can be viewed as having two key steps: first, estimation of a single fully conditional model for the outcome and second, estimation of mediation functionals from that model. As a result, this approach allows for mediation analysis with a straightforward application of regression modeling tools—e.g., penalization procedures such as the elastic net or lasso, multiple imputation, and cross-validation. One simply applies these techniques to the single well-specified full model and their impact is automatically incorporated in the mediation functionals.

Remark B: Advantage of using one outcome model in multiple mediator settings

As pointed out by VanderWeele and Vansteelandt (2013), the approach of using one outcome model for all of the mediators is “robust to unmeasured common causes Inline graphic of two or more mediators,” whereas having separate outcome models for each mediator is not. When the outcome model contains all the mediators, Inline graphic only affects the outcome through the set of mediators, so Inline graphic does not confound the joint effect of Inline graphic on Inline graphic. If, instead, one specifies a separate outcome model for each mediator, Inline graphic affects Inline graphic and it affects Inline graphic through Inline graphic, which leads to biased estimates of the the effect Inline graphic on Inline graphic. Thus, it is recommended to specify one full outcome model that contains all of the mediators.

Remark C: Controlled indirect effect

“Controlled indirect effects are notably difficult to conceptualize, and instead are defined as some contrast between the total and controlled direct effects in the absence of exposure-mediator interactions” (Naimi and others, 2014). Our approach provides a general formula for estimating the difference between the total effect and the CDE, i.e., the so-called controlled indirect effect. By contrast, the mediation formula provides a general formula for estimating the NIE, the difference between the total effect and the NDE (Pearl, 2001).

Remark D: Non-nested submodels

To use the single-model approach, the implied submodel must be nested within the full model. The simple exposure–mediator interaction model is a commonly encountered example of a marginal model that is not nested. The full model Inline graphic has the implied submodel Inline graphic. This full model contains a linear term for Inline graphic, which implies the entire nonlinear effect of the exposure is captured by the mediator (via the interaction). This is an impactful assumption that we would prefer to relax by including the nonlinear exposure effects Inline graphic in both the full and marginal models.

Remark E: Fitted versus implied total effect

The standard approach in the causal inference literature is to use the implied total effect that results from fitting the full outcome model and the model for the mediator. We say “implied” here, because the marginal model Inline graphic is never actually fit to the data. Instead, the sum of the estimated NDE and NIE is used as the total effect estimate (e.g., this is how the mediation package in R estimates the total effect). In contrast, our approach estimates the total effect directly from the fitted marginal model.

Importantly, the estimated total effect obtained from fitting the marginal model Inline graphic does not necessarily equal the sum of the estimated NDE and NIE, an unexpected finding. We found this to be the case when fitting the full model Inline graphic, the mediator model Inline graphic, and the implied marginal model Inline graphic. To be clear, our empirical estimate of the total effect Inline graphic did not equal the sum of the NDE and NIE. We can only speculate that the maximum likelihood fit of the submodel is not equivalent to the implied submodel derived from the maximum likelihood fits of the first two models. One explanation is that several different systems of equations will yield the same submodel, but only one submodel is implied once the outcome model and mediator model are fit. This is an interesting finding that merits further study.

8. Software

While the BRAIN-ICU data used for the examples are not publicly available, software in the form of R code and documentation is available at https://github.com/trippcm/Biostatistics-Mediation-R-Code

Supplementary Material

Supplementary Data

Acknowledgments

Example data were derived from the “Bringing to Light the Risk Factors and Incidence of Neuropsychological Dysfunction in ICU Survivors (BRAIN-ICU) Study” funded by the NIH (AG027472) and published in NEJM (Pandharipande and others, 2013). We appreciate the contributions and comments of BRAIN-ICU investigators Timothy Gerard, Wes Ely, and Pratik Pandharipande. The authors thank Professors Kristopher Preacher, Jonathan Schildcrout, Robert Johnson, Melinda Aldrich, Bryan Shepherd, and Robert Greevy for critical reading, helpful suggestions, and valuable feedback of the original version of the paper. We are also grateful for the constructive comments from the associate editor and two anonymous referees, which ultimately improved the presentation of our ideas. The ideas for this work began when Christina Saunders was supported by CTSA award TL1TR000447 from the National Center for Advancing Translational Sciences. Conflict of Interest: None declared.

References

  1. Alwin D. F. and Hauser R. M. (1975). The decomposition of effects in path analysis. American Sociological Review 40, 37–47. [Google Scholar]
  2. Baron R. M. and Kenny D. A. (1986). The moderator-mediator variable distinction in social psychological research: conceptual, strategic, and statistical considerations. Journal of Personality and Social Psychology 51, 1173–1182. [DOI] [PubMed] [Google Scholar]
  3. Fisher R. A. (1915). Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population. Biometrika 10, 507–521. [Google Scholar]
  4. Fritz M. S. and MacKinnon D. P. (2007). Required sample size to detect the mediated effect. Psychological Science 18, 233–239. [DOI] [PMC free article] [PubMed] [Google Scholar]
  5. Gunzler D., Chen T., Wu P. and Zhang H. (2013). Introduction to mediation analysis with structural equation modeling. Shanghai Archives of Psychiatry 25, 390–394. [DOI] [PMC free article] [PubMed] [Google Scholar]
  6. Hayes A. F. (2013). Introduction to Mediation, Moderation, and Conditional Process Analysis: A Regression-Based Approach. New York, NY: Guilford Press. [Google Scholar]
  7. Holland P. (1986). Statistics and causal inference. Journal of the American Statistical Association 81, 945–960. [Google Scholar]
  8. Imai K., Keele L. and Tingley D. (2010). A general approach to causal mediation analysis. Psychological Methods 15, 309–334. [DOI] [PubMed] [Google Scholar]
  9. MacKinnon D. P. (2008). Introduction to Statistical Mediation Analysis. Abingdon, UK: Taylor & Francis Group. [Google Scholar]
  10. MacKinnon D. P., Lockwood C. M., Hoffman J. M., West S. G. and Sheets V. (2002). A comparison of methods to test mediation and other intervening variable effects. Psychological Methods 7, 83–104. [DOI] [PMC free article] [PubMed] [Google Scholar]
  11. MacKinnon D. P., Lockwood C. M. and Williams J. (2004). Confidence limits for the indirect effect: distribution of the product and resampling methods. Multivariate Behavioral Research 39, 99–128. [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. MacKinnon D. P., Warsi G. and Dwyer J. H. (1995). A simulation study of mediated effect measures. Multivariate Behavioral Research 30, 41. [DOI] [PMC free article] [PubMed] [Google Scholar]
  13. Naimi A. I., Kaufman J. S. and MacLehose R. F. (2014). Mediation misgivings: ambiguous clinical and public health interpretations of natural direct and indirect effects. International Journal of Epidemiology 43, 1656–1661. [DOI] [PubMed] [Google Scholar]
  14. Pandharipande P. P., Girard T. D., Jackson J. C., Morandi A., Thompson J. L., Pun B. T., Brummel N. E., Hughes C. G., Vasilevskis E. E., Shintani A. K., Moons K. G., Geevarghese S. K. and others. (2013). Long-term cognitive impairment after critical illness. The New England Journal of Medicine 369, 1306–1316. [DOI] [PMC free article] [PubMed] [Google Scholar]
  15. Pearl J. (2001). Direct and indirect effects. In: Breese J and Koller D (editors), Proceedings of the 17th Conference in Uncertainty in Artificial Intelligence. San Francisco, CA: Morgan Kaufmann Publishers Inc, pp. 411–420. [Google Scholar]
  16. Pearl J. (2012a). The causal mediation formula–a guide to the assessment of pathways and mechanisms. Prevention Science : The Official Journal of the Society for Prevention Research 13, 426–436. [DOI] [PubMed] [Google Scholar]
  17. Pearl J. (2012b). The mediation formula: a guide to the assessment of causal pathways in nonlinear models. In: Berzuini C., Dawid P. and Bernard L. (editors), Causality: Statistical Perspectives and Applications. Hoboken, New Jersey: John Wiley and Sons, pp. 151–179. [Google Scholar]
  18. Preacher K. J. (2015). Advances in mediation analysis: a survey and synthesis of new developments. The Annual Review of Psychology 66, 4.1–4.28s. [DOI] [PubMed] [Google Scholar]
  19. Preacher K. J. and Hayes A. F. (2008). Contemporary approaches to assessing mediation in communication research. In: Hayes A. F., Slater M. D. and Snyder L. B. (editors), Advanced Data Analysis Methods for Communication Research. Thousand Oaks, California: SAGE Publications, Inc, pp. 13–54. [Google Scholar]
  20. Robins J. M. and Greenland S. (1992). Identifiability and exchangeability for direct and indirect effects. Epidemiology 3, 143–155. [DOI] [PubMed] [Google Scholar]
  21. Sobel M. E. (1982). Asymptotic confidence intervals for indirect effects in structural equation models. Sociological Methodology 13, 290–312. [Google Scholar]
  22. Stone C. A. and Sobel M. E. (1990). The robustness of estimates of total indirect effects in covariance structure models estimated by maximum likelihood. Psychometrika 55, 337–352. [Google Scholar]
  23. VanderWeele T. J. (2013). Policy-relevant proportions for direct effects. Epidemiology 24, 175–176. [DOI] [PMC free article] [PubMed] [Google Scholar]
  24. VanderWeele T. J. (2015). Explanation in Causal Inference: Methods for Mediation and Interaction. Oxford, UK: Oxford University Press. [Google Scholar]
  25. VanderWeele T. and Vansteelandt S. (2013). Mediation analysis with multiple mediators. Epidemiologic Methods 2, 95–115. [DOI] [PMC free article] [PubMed] [Google Scholar]
  26. Woodworth R. S. (1928). Dynamic psychology. In: Murchison C. (editor), Psychologies of 1925. Worcester, MA: Clark University Press, pp. 111–126. [Google Scholar]
  27. Zhao X., Lynch J. G. Jr and Chen Q. (2010). Reconsidering Baron and Kenny: myths and truths about mediation analysis. Journal of Consumer Research 37, 197–206. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supplementary Data

Articles from Biostatistics (Oxford, England) are provided here courtesy of Oxford University Press

RESOURCES