Skip to content
Publicly Available Published by De Gruyter April 4, 2015

Within-Subject Mediation Analysis in AB/BA Crossover Designs

  • Haeike Josephy EMAIL logo , Stijn Vansteelandt , Marie-Anne Vanderhasselt and Tom Loeys

Abstract

Crossover trials are widely used to assess the effect of a reversible exposure on an outcome of interest. To gain further insight into the underlying mechanisms of this effect, researchers may be interested in exploring whether or not it runs through a specific intermediate variable: the mediator. Mediation analysis in crossover designs has received scant attention so far and is mostly confined to the traditional Baron and Kenny approach. We aim to tackle mediation analysis within the counterfactual framework and elucidate the assumptions under which the direct and indirect effects can be identified in AB/BA crossover studies. Notably, we show that both effects are identifiable in certain statistical models, even in the presence of unmeasured time-independent (or upper-level) confounding of the mediator–outcome relation. Employing the mediation formula, we derive expressions for the direct and indirect effects in within-subject designs for continuous outcomes that lend themselves to linear modelling, under a large variety of settings. We discuss an estimation approach based on regressing differences in outcomes on differences in mediators and show how to allow for period effects as well as different types of moderation. The performance of this approach is compared to other existing methods through simulations and is illustrated with data from a neurobehavioural study. Lastly, we demonstrate how a sensitivity analysis can be performed that is able to assess the robustness of both the direct and indirect effect against violation of the “no unmeasured lower-level mediator–outcome confounding” assumption.

1 Introduction

The concept of mediation has received a great deal of attention during the last couple of decades, with Baron and Kenny [1] among the first to scratch the surface of this vast realm. These authors presented a causal-steps approach to establish whether or not a variable serves as the generative mechanism, through which an independent variable (subsequently referred to as the “exposure” X) influences a dependent variable of interest (the “outcome” Y). Any such “mediator” variable may help to clarify the nature of the relationship between exposure and outcome. The question of whether or not the causal effect of exposure X on outcome Y (partly) runs through a mediator M, can be verified by decomposing the total effect of X on Y into a direct and an indirect effect (see Figure 1). The traditional Baron and Kenny framework, which assumes independent observations of X, M and Y (with the latter two measured at the interval level), relies on three regression equations:

(1)Y=iY1+cX+eY1M=iM+aX+eMY=iY2+cX+bM+eY2
Figure 1: Decomposition of a total effect (of exposure X on outcome Y) into a direct (not through the mediator M) and an indirect effect (through the mediator M), by means of mediation analysis.
Figure 1:

Decomposition of a total effect (of exposure X on outcome Y) into a direct (not through the mediator M) and an indirect effect (through the mediator M), by means of mediation analysis.

The above-mentioned direct effect is conventionally captured by c, which is justified provided all relations in the path diagram in Figure 1 are linear and satisfy a specific set of “no unmeasured confounders” assumptions [2]. The indirect effect, on the other hand, can be obtained either by means of the product-of-coefficients approach (as a product of its constituent path coefficients, ab) or by means of the difference-of-coefficients approach (cc). Both estimators are equivalent in linear models [3].

In AB/BA crossover studies, where each participant is observed exactly twice (once under exposure A and once under B, see Figure 2), observations are no longer independent and exhibit a multilevel structure (where the subject is considered the upper level and the measurement moment the lower level). Such AB/BA crossover trials are ubiquitous, as they can effectively eliminate between-patient variation from the data [4]. Unfortunately, when it comes to decomposing the total effect, the mediation analysis literature has almost exclusively relied on extending the product-of-coefficients approach to multilevel settings [510], without due attention to the interpretation of the effects as direct and indirect effects, and to the underlying assumptions needed to identify these.

Figure 2: The mechanism of a simple AB/BA$$BA$$ crossover design. Each treatment (treatment A and B) is administered during one of two periods, the sequence of which (sequence AB or BA) is determined during randomization.
Figure 2:

The mechanism of a simple AB/BA crossover design. Each treatment (treatment A and B) is administered during one of two periods, the sequence of which (sequence AB or BA) is determined during randomization.

To surmount these limitations, this paper will tackle mediation analysis in crossover designs from a counterfactual perspective. This framework has proven useful in explicating the assumptions underlying mediation analysis, and in identifying the direct and indirect effects of interest [1115]. In Section 2, we start by defining counterfactual outcomes in the AB/BA design, introduce non-parametric expressions for the direct and indirect effect and discuss the assumptions needed to identify both effects. Subsequently, we derive expressions for these effects under a simple data-generating mechanism that satisfies these assumptions. In Section 3, we discuss Judd et al. [6]’s difference approach alongside three multilevel approaches for the assessment of within-subject mediation in this simple setting. Next, we consider more complex data-generating mechanisms involving a variety of interactions (Section 4), introduce an extension of the difference approach to accommodate such moderation and compare the relative performance of the different estimation approaches in a simulation study (Section 5). Furthermore, employing data from a crossover experiment that evaluates the effect of neurostimulation on ruminative thinking, we illustrate how the different estimation techniques may lead to contrasting conclusions about the indirect effect running through the working memory (Section 6). Additionally, since we will show in the subsequent section that mediation analysis in crossover settings relies on the assumption of “no unmeasured lower-level MY confounding”, we develop a sensitivity analysis method. This analysis appraises the robustness of the estimated direct and indirect effect against violations of this assumption, and can easily be embedded within our proposed estimation framework. We end with a discussion.

2 Specification of the natural direct and indirect effects in within-subject mediation models

2.1 The counterfactual framework

In order to formalize the notion of direct and indirect effects, we introduce counterfactual outcomes in AB/BA crossover settings. A “counterfactual” or “potential outcome” Yit(x) denotes the outcome that we would (possibly contrary to fact) have observed for individual i at the end of period t, had the exposure Xit been set to a value x through some manipulation [16]. Since the AB/BA design dictates a dichotomous exposure (with a value 0 for baseline exposure or no exposure, and 1 otherwise), each subject is tied to exactly two potential outcomes during a specific period: Yit(0) and Yit(1). With these definitions, the individual period-specific total effect of X on Y is defined as the difference between both counterfactuals: Yit(1)Yit(0). Since only one of both potential outcomes is actually observed for each individual during period t, the period-specific individual total effect is unobserved. In contrast, the population average of the total causal effect (TCE) E[Yit(1)Yit(0)] can be identified under specific assumptions (cf. infra).

Similarly, counterfactuals for the mediator, Mit(0) and Mit(1), can be defined. These represent the mediator values for an individual during period t, under exposure 0 and 1, respectively. Relying on these definitions, a nested counterfactual Yit(x,Mit(x)) can be devised [12, 17]. It represents the value for the outcome Yit, when Xit is set to x and Mit is fixed at the value it would obtain when Xit=x. Nested counterfactuals allow us to rephrase the average period-specific total effect of X on Y, to include the mediator: E[Yit(1,Mit(1))Yit(0,Mit(0))]=E[Yit(1)Yit(0)]. This moreover allows the partitioning of a TCE into a direct and indirect effect. Such effect decomposition can occur in two ways: one possibility is to decompose the TCE into a total natural indirect effect (TNIE) and a pure natural direct effect (PNDE); the other decomposition yields a pure natural indirect effect (PNIE) and a total natural direct effect (TNDE) [18, 19]:

(2)TCE=E[Yit(1,Mit(1))Yit(0,Mit(0))]=E[Yit(1,Mit(1))Yit(1,Mit(0))+Yit(1,Mit(0))Yit(0,Mit(0))]=TNIE+PNDE=E[Yit(1,Mit(1))Yit(0,Mit(1))+Yit(0,Mit(1))Yit(0,Mit(0))]=TNDE+PNIE

We will focus on the first decomposition (TCE=TNIE+PNDE) from now on.

2.2 Causal and modelling assumptions

To identify the (pure) natural direct and (total) natural indirect effect in multilevel settings, the standard set of “no unmeasured confounding” assumptions for simple settings with independent observations, has been generalized as follows [15]:

  1. There are no unmeasured upper- or lower-level confounders of the association between exposure and mediator.

  2. There are no unmeasured upper- or lower-level confounders of the association between mediator and outcome.

  3. There are no unmeasured upper- or lower-level confounders of the association between exposure and outcome.

  4. There are no confounders of the association between mediator and outcome, caused by exposure (i.e. no intermediate confounding).

    In crossover settings, the upper level refers to the individual i, while the lower level refers to the period t at which measurements were taken. Crossover designs render several of these assumptions obsolete. Since the sequence of exposure is by definition randomized, the first and third assumption are redundant. Also, as crossover studies are able to eliminate between-subject variation, we will show that the second assumption can sometimes be weakened to: (iib) There are no unmeasured lower-level confounders of mediator and outcome. In addition to these four confounding assumptions, we add the following assumption:

  5. There is no causal transience (no carry-over effect): exposure, mediator and outcome measures from the first period cannot affect mediator and outcome measures from the second period.

Assumption (v) is plausible in crossover designs if the wash-out period is sufficiently long.

These assumptions related to the AB/BA design can be summarized by the (lack of) arrows in the directed acyclic graph of Figure 3, which we will interpret as a nonparametric structural equation model with independent errors [20]. In this causal diagram, Xi0, Mi0 and Yi0 represent the exposure, mediator and outcome values for subject i, measured during the first period (t=0), while Xi1, Mi1 and Yi1 denote these values during the second period (t=1).

Note that in view of assumptions (iv) and (v), we do not allow the exposure, mediator and outcome measurements from the first period to causally affect the outcome and mediator values of the second period, respectively. Also, assumption (iv) dictates that measured within-subject confounders in the second period should not be affected by the exposure (or the mediator) of the first period. We do, on the other hand, allow for unmeasured subject-specific, period-independent common causes U of the outcome to correlate with unmeasured subject-specific and period-independent common causes V of the mediator (relaxation of assumption (ii) into (iib)), provided that assumptions (vi) and (vii) hold. Note that V can be expressed as a function of U (i.e. g(U)) without loss of generality, rendering the unmeasured upper-level confounding of the MY relationship more explicit.

In addition to the above-mentioned causal assumptions, we will make the following modelling assumptions throughout this paper:

  1. Unmeasured upper-level confounders of the association between mediator and outcome exert an additive effect on both the mediator and the outcome.

  2. There is no unmeasured heterogeneity among subjects in the effect of exposure on mediator and in the effect of exposure and mediator on outcome.

Figure 3: Causal diagram, graphically representing the causal assumptions regarding mediation in AB/BA$$AB/BA$$ crossover designs. The variables Xi0$${X_{i0}}$$, Mi0$${M_{i0}}$$ and Yi0$${Y_{i0}}$$ represent the respective values of the exposure, mediator and outcome for subject i during the first measurement period. Xi1$${X_{i1}}$$, Mi1$${M_{i1}}$$ and Yi1$${Y_{i1}}$$, on the other hand, reflect these variables assessed during the second measurement period. The unmeasured upper-level confounders Vi$${V_i}$$ of the mediator and Ui$${U_i}$$ of the outcome allow for upper-level M–Y$$Y$$ confounding. Absence of a unidirectional arrow between two variables indicates the absence of a direct causal effect between them, while a bidirectional arrow captures an unmeasured common cause.
Figure 3:

Causal diagram, graphically representing the causal assumptions regarding mediation in AB/BA crossover designs. The variables Xi0, Mi0 and Yi0 represent the respective values of the exposure, mediator and outcome for subject i during the first measurement period. Xi1, Mi1 and Yi1, on the other hand, reflect these variables assessed during the second measurement period. The unmeasured upper-level confounders Vi of the mediator and Ui of the outcome allow for upper-level MY confounding. Absence of a unidirectional arrow between two variables indicates the absence of a direct causal effect between them, while a bidirectional arrow captures an unmeasured common cause.

Unlike path diagrams in the structural equation modelling framework, the lack of interactions implied by assumptions (vi) and (vii) (i.e. no interactions with unmeasured confounders Ui and Vi) cannot be represented on a causal diagram. These assumptions are therefore not depicted in Figure 3.

Throughout the paper, we will make no assumptions regarding temporal stability and accordingly allow for period effects, implying that the outcome and mediator values can depend on the measurement moment. This is important because period effects are quite common in crossover studies [21] (e.g. seasonal effects, changes in measurement conditions, disease progression, habituation) and ignoring them would be disadvantageous for two reasons. First, if the exposure sequence were allocated in an unbalanced way, ignoring a period effect would bias the estimate of the exposure effect [4, 22]. Second, if such a trend exists but was not taken into account, its influence would be attributed to random variation instead of systematic changes, resulting in an inflated variance of the effect of X [4].

3 Estimating direct and indirect effects in simple settings with no interactions

Based on the above stipulated set of assumptions, we start with a simple data-generating mechanism for the mediator and outcome (for subject i during period t):

(3)Mit=δM+αXit+κMt+g(Ui)+εMitYit=δY+ζXit+βMit+κYt+Ui+εYit

Under this mechanism, in correspondence to Figure 3, the mediator value of subject i during period t may be affected by exposure Xit, as well as by unmeasured individual level confounders Vi=g(Ui). Similarly, the outcome of individual i during period t may be affected by the exposure Xit, the mediator Mit and any unmeasured subject level confounders Ui. In the equations above, the parameters δM and δY represent the respective intercepts for M and Y, while α, β and ζ represent the effects of exposure on mediator, mediator on outcome and exposure on outcome, respectively. Note that we assume that those effects are homogeneous across subjects (in accordance with assumption (vii)). The parameters κM and κY define the respective period effects of M and Y. The presence of Ui and g(Ui) in the models for Y and M, allows for unmeasured time-independent, subject-specific confounding of the MY relationship, without making strong parametric assumptions about their effects. Furthermore, Ui is independent of both exposure and period, and exhibits additive effects on mediator and outcome (in accordance with assumption (vi)). Finally, εMit and εYit represent the lower-level error terms, which are assumed to have mean zero and to be independent from the model predictors, as well as from one another.

Starting from this simple setting, the next section will first describe the identification of the natural direct and indirect effect. Next, we will summarize four existing approaches that can assess within-subject mediation in AB/BA crossover designs (Sections 3.23.5).

3.1 Identification of the direct and indirect effect

Under the above-described data-generating mechanism, the assumptions introduced in Section 2.2 are met. This enables us to operate Pearl’s mediation formula [12, 23] in deriving the total, PNDE and TNIE for each subject i (conditional on i) during period t. Based on eq. (3), the subject- and period-specific TCE equals αβ+ζ, the individual- and period-specific TNIE equals αβ and the PNDE in turn equals ζ (detailed calculations can be found in the supporting Appendix A.1).

3.2 The difference approach for the AB/BA design

Judd et al. [6] proposed a straightforward method to evaluate mediation in AB/BA crossover designs specifically. They suggested an approach in which they perform regression on the differences of mediator and outcome values under both exposures, hereby eliminating between-subject variability. Following their approach, mediation can be assessed in three consecutive steps:

  • The first step determines whether or not there is evidence for an overall effect of exposure on outcome, by performing a paired t-test on the outcomes under both exposures. Let Yix=1 and Yix=0 represent the outcome variables for subject i under exposure (X=1) or no exposure (X=0), respectively. When modelling the outcome differences through linear regression, the average effect of the exposure X on the outcome Y is estimated by the intercept c:

    YiDif=Yix=1Yix=0=c+eYi1

    with error terms eYi1. If there is evidence of such a total effect c different from zero, one can proceed to the next step.

  • The second step tests whether or not there is evidence for an effect of X on M, by performing a paired t-test on the mediator values under both exposures. Let Mix=1 and Mix=0 represent the mediator variables for subject i under exposure (X=1) or not (X=0), respectively. The average effect of X on M can be estimated by the intercept a, from a linear regression model for these differences.

    MiDif=Mix=1Mix=0=a+eMi

    with error terms eMi. If there is evidence of an effect of exposure on mediator, one can proceed to the next step.

  • The final step assesses mediation itself. In the absence of moderation, mediation is evaluated by regressing the outcome differences (YiDif) on the mediator differences (MiDif):

    YiDif=c+bDifMiDif+eYi2

    with error terms eYi2. Now, the intercept c captures the direct effect, while the coefficient of MiDif describes the effect of the mediator on the outcome. When it is found that the effect of MiDif on the outcome differences is significantly different from zero, one can conclude that there is indeed mediation. Judd et al. [6] argue that the type of mediation can subsequently be determined by the significance of the intercept in this equation: if it differs significantly from zero, partial mediation has occurred, if not, researchers can claim complete mediation.

Although this method elegantly bypasses the need for multilevel modelling approaches (which we discuss from Section 3.3 onwards) and eliminates between-subject variation (and hence any unmeasured confounders of the MY relationship that have additive effects at the subject level), it has several drawbacks. Besides the frequently raised criticism concerning the necessity of each of the different steps [2428], a first shortcoming is that the approach is not based on a quantification of the very thing it is attempting to test – the indirect effect [25]. A second drawback is that it does not account for period effects [4, 21].

3.3 Standard multilevel mediation analysis

Another approach for mediation analysis in the AB/BA design relies on multilevel modelling of the mediator and outcome [29]. Allowing for a period effect, the following lower-level equations would typically be considered:

(4)Mit=dMi+aXit+kMt+eMitYit=dYi+cXit+bMit+kYt+eYit

alongside the following upper-level (e.g. individual-level) equations:

dMi=dM+uMiwithuMiXit
dYi=dY+uYiwithuYiXit,Mit

Here, dMi and dYi represent the random intercepts, while eMit and eYit encode the lower-level error terms. The terms uMi and uYi, on the other hand, represent the upper-level error terms (subject level) for the random intercepts, assumed to be independent (as depicted by the symbol ) of the predictors in their respective equations. Both upper- and lower-level error terms are assumed to be independently and normally distributed with mean zero.

Throughout this paper, maximum likelihood estimators for the parameters from the working models are denoted with “”. The TNIE is estimated from eq. (4) as aˆbˆ, while the PNDE is estimated from eq. (4) as cˆ. Unfortunately, since uYi reflects unmeasured subject-specific variability in Yit and is assumed to be independent of Mit, it is unable to capture the unmeasured subject-specific confounding of the MY relationship, under data-generating mechanism (3). This may result in an “omitted variable bias” [30] for β and ζ when such confounding is indeed present (as is the case in data-generating mechanism (3)), resulting in biased estimators for direct and indirect effect ζ and αβ. To this end, we will henceforth refer to this approach as the naive modelling approach.

3.4 Approaches separating within-subject and between-subject effects

Many scholars have recently commented on the importance of separating within-subject from between-subject effects in multilevel settings [8, 9, 3135]. Within-effects (effects of the deviations from the subject means) and between-effects (effects of the subject means) can be different and even opposite in [35, 36]. This can result from unmeasured upper-level confounding, which is absorbed in the between-subject effect [37]. In view of this, allowing both effects in the outcome equation will not dictate a “forced average” of within- and between-effects, as demanded by the single parameter coefficient when no centring of the mediator is used. In this paper, we focus on the within-subject effects, as these are of primary interest in crossover studies.

Following MacKinnon [29], the within-subject effect can be estimated by regressing Yit on the subject-mean-centred mediator (MitMit). Here Mit denotes the subject-specific average of the Mit scores for subject i across periods. This modelling approach can be described by the following set of linear mixed models:

(5)Mit=dMi+aXit+kMt+eMitwithdMi=dM+uMiYit=dYi+cXit+b(MitMit)+kYt+eYitwithdYi=dY+uYi

The lower-level residuals eMit and eYit, as well as the upper-level error terms uMi and uYi, are again assumed to be independently distributed with mean zero. Under the assumed data-generating mechanism (eq. (3)), the unmeasured confounder Ui is uncorrelated with MitMit. That is to say, while (un)measured individual level confounders of the outcome might correlate with the time-dependent Mit scores, these subject-mean-centred mediators will no longer correlate with Ui. Hence, subtraction of the individual mean from period-specific Mit scores will effectively eliminate any additive upper-level confounding of the MY relation, in contrast to the naive modelling approach. We will refer to this procedure as the separate W(ithin)-only modelling approach.

Assuming data-generating mechanism (3) holds, the TNIE can be estimated unbiasedly from eq. (5) as aˆbˆ and the PNDE as cˆ.

A second centring approach not only models the effect of the subject-mean-centred mediator on the outcome, but also the effect of the subject mean of the mediator itself [29]. By doing so, two separate estimates for the effect of M on Y are obtained: a within-subject effect and a between-subject effect. This approach is equivalent to the separate W-only approach for the estimation of within-subject effects in linear models, because of Mi being uncorrelated with (MitMi) and is, as such, not further considered.

3.5 A joint modelling approach

Another multilevel approach, described by Bauer, Preacher, and Gil [5], models the mediator and the outcome jointly, in a way that allows for unmeasured subject-specific common causes of M and Y, by incorporating a covariance term for the two random intercepts. Technically, this can be achieved by creating a new outcome variable Z which stacks M and Y for each period t within individual i. Next, two dummy variables are defined as follows: SM=1 when Z=M and SM=0 otherwise, and similarly SY=1 when Z=Y and SY=0 otherwise:

(6)Zit=SM(dMi+aXit+kMt)+SY(dYi+cXit+bMit+kYt)+eZit

This enables fitting a multivariate model, using univariate multilevel software (e.g. PROC MIXED in SAS). In contrast to the Naive modelling approach where uMi and uYi are assumed to be independent, this approach assumes the random intercepts to be bivariate normally distributed. Unmeasured upper-level MY confounding may therefore be captured by the correlation between both random effects. As such, it allows assessment of the viability of the assumption required in the naive modelling approach, namely that no upper-level MY confounding is present. This method will be referred to as the joint modelling approach.

The total effect under data-generating mechanism (3) is estimated from eq. (6) as aˆbˆ and the PNDE as cˆ. Since, in contrast to the separate modelling approaches, the estimation of fixed effects in the joint modelling approach relies on a bivariate normal distribution of the random intercepts, violation of this assumption may lead to biased fixed effects even if the mean is correctly specified. As shown in the supporting Appendix A.2, one may expect bias when (a) Mit is non-normally distributed (because of non-normal random effects or residual errors), when (b) the distribution of uYi is non-normal or when (c) uYi moderates (i.e. modifies) the effect of Mit in the outcome model.

4 Estimating direct and indirect effect in more complex settings involving interactions

The data-generating mechanism that we considered so far (eq. (3)), assumed no moderating effects of exposure. This section allows for an interaction between exposure and mediator, moderation of the exposure effect by measured upper-level confounders Di for both the mediator and outcome, as well as moderation of the mediator–outcome relationship by Di. These effects can be jointly represented by the following data-generating mechanism:

(7)Mit=δM+αXit+κMt+ωMDi+νMXitDi+g(Ui)+εMitYit=δY+ζXit+βMit+ϕXitMit+κYt+ωYDi+νYXitDi+ηMitDi+Ui+εYit

Here, Di is a vector of measured confounders at the subject level. Without loss of generality, we can assume that E[Di]=0. The parameter ϕ encodes the moderating effect of the mediator on the effect of exposure on outcome, while νM and νY represent moderation of confounders Di on the effect of X on M and of X on Y, respectively. The parameter η in turn encodes the moderating effect of confounders Di on the effect of the mediator on the outcome. As before, we assume additive effects for the unmeasured confounders Ui and g(Ui).

4.1 Identification of the direct and indirect effect in complex settings

Under data-generating mechanism (7) the assumptions introduced in Section 2.2 continue to apply, which enables use of the mediation formula to derive the TCE, PNDE and TNIE for subject i during period t. Here, the subject- and period-specific TNIE equals (detailed calculations can be found in the supporting Appendix A.3):

(8)E[Yit(1,Mit(1))Yit(1,Mit(0))|Di=d,Ui]=m{E[Yit|Xit=1,Mit=m,Di=d,Ui]P(Mit=m|Xit=1,Di=d,Ui)E[Yit|Xit=1,Mit=m,Di=d,Ui]P(Mit=m|Xit=0,Di=d,Ui)}=(α+νMd)(β+ϕ+ηd)

Since this expression does not depend on Ui (see Appendix A.3), the subject- and period-specific TNIE can be marginalized over Ui (E[Yit(1,Mit(1))Yit(1,Mit(0))|Di=d,Ui]=E[Yit(1,Mit(1))Yit(1,Mit(0))|Di=d]).

This does not always hold for the PNDE and TCE; Appendix A.3 demonstrates their dependence on unmeasured upper-level confounders Ui, when ϕ0. This dependency on unmeasured upper-level confounders can be dealt with in one of two ways. A first possibility is to consider the PNDE at g(Ui)=0:

(9)E[Yit(1,Mit(0))Yit(0,Mit(0))|Di=d,Ui]=m{E[Yit|Xit=1,Mit=m,Di=d,Ui]P(Mit=m|Xit=0,Di=d,Ui)E[Yit|Xit=0,Mit=m,Di=d,Ui]P(Mit=m|Xit=0,Di=d,Ui)}=ζ+νYd+ϕ(δM+κMt+ωMd)

and TCE at g(Ui)=0:

(10)E[Yit(1,Mit(1))Yit(0,Mit(0))|Di=d,Ui]=m{E[Yit|Xit=1,Mit=m,Di=d,Ui]P(Mit=m|Xit=1,Di=d,Ui)E[Yit|Xit=0,Mit=m,Di=d,Ui]P(Mit=m|Xit=0,Di=d,Ui)}=(α+νMd)(β+ϕ+ηd)+ζ+νYd+ϕ(δM+κMt+ωMd)

respectively. However, these lack a clear interpretation due to the fact that Ui is unmeasured and the subgroup g(Ui)=0 therefore unknown.

Alternatively, one may estimate the TCE marginally over Ui, for example by regressing the outcome Yit on Xit and Di. The PNDE marginalized over Ui can subsequently be estimated by subtracting the TNIE from this estimated total effect.

Finally note that for these settings the period effect comes into play, as the direct as well as the total effect now show time dependency. The indirect effect, however, remains constant over time.

4.2 A more flexible difference approach

The previously discussed difference approach by Judd et al. [6] explicitly allows testing for one specific type of moderated mediation: moderation of the relation between exposure and outcome by the mediator itself. Technically, this is done by using the sum of the two mediator values MiSum, as a predictor in addition to the difference MiDif, in the model for the outcome: YiDif=c+bDifMiDif+bSumMiSum+eYi2. Moderation is then assessed by testing whether or not bSum equals zero, but again no indirect effect estimators are derived. Interactions including external moderators are not allowed for by this approach either, but may often occur in practice [27, 38, 39]. To allow for such moderation, as well as the above-mentioned period effects, we will extend the approach proposed by Judd et al. [6] as follows:

(11)MiDif=a+kMtiDif+vMDi+eMiYiDif=c+bMiDif+fXMiDif+kYtiDif+vYDi+nDiMiDif+eYi

In eq. (11), XMiDif equals Mix=1 and tiDif=tix=1tix=0, where tix=0 and tix=1 represent the measurement moments (t=0 or 1) when no treatment and treatment were administered to individual i, respectively. The error terms eMi and eYi are once again assumed to be normally and independently distributed with mean zero. We will refer to this approach as the difference approach from now on. Since under data-generating mechanism (7):

(12)MiDif=α+κMtiDif+νMDi+εMiYiDif=ζ+βMiDif+ϕXMiDif+κYtiDif+νYDi+ηDiMiDif+εYi

the difference approach will allow unbiased estimation of the indirect effect in this setting. The indirect effect can be estimated from eq. (11) as aˆ(bˆ+fˆ) when Di=0, or by (aˆ+vˆMd)(bˆ+fˆ+nˆd) when Di=d. Estimation of the direct effect, on the other hand, is more complicated. When there is no XM interaction (ϕ=0), all parameters that constitute the direct effect can be unbiasedly estimated with the difference approach under the assumed data-generating mechanism. However, when ϕ0, we suggest the above-mentioned approach based on subtracting the estimated indirect effect from the total effect (both marginalized over Ui).

A final remark can be made regarding eq. (11), which assumes the subject-level confounders Di are measured. If these confounders remain unmeasured, however (and are therefore not included in the estimating equations), assumption (vi) will be violated and the difference approach may yield biased estimates for the parameters of interest. There may be bias in the estimates for the parameters in the outcome eq. (12) when νY0 or η0, as the interaction term between the exposure and Di is correlated with MiDif, and the interaction term between the mediator and Di is correlated with Mix=1. However, when νY=0 and η=0, but νM0, the estimator aˆd(bˆd+fˆd) (where the subscript d refers to the estimates in the model ignoring Di) will still provide an unbiased estimate of the indirect effect at average levels of Di. Indeed, when νY=η=0, omitting Di introduces no bias for bˆ and fˆ, and as residuals are assumed to have a zero mean, the intercept aˆd reflects the effect of exposure on mediator at average values of Di.

4.3 The naive, separate W-only and joint modelling approach in complex settings

The naive and joint modelling approach can incorporate the moderation effects present in data-generating mechanism (7), by adding the respective interaction terms to the models. These become

(13)Mit=dMi+aXit+kMt+wMDi+vMXitDi+eMitYit=dYi+cXit+bMit+fXitMit+kYt+wYDi+vYXitDi+nMitDi+eYit

where the joint modelling approach additionally models a covariance term for both random effects.

The method that separates between- from within-subject effects can also incorporate such moderation, by adding interaction terms with the subject-mean deviation scores of the mediator. The model becomes

(14)Mit=dMi+aXit+kMt+wMDi+vMXitDi+eMitYit=dYi+cXit+b(MitMit)+f(XitMitXitMit)+kYt+wYDi+vYXitDi+n(MitMit)Di+eYit

Note that the XM interaction is modelled as the difference between the product of the individual, time-specific exposure and mediator values, and the average of this product over periods, within individuals; modelling it any other way (e.g. as Xit(MitMit)) might lead to bias in the presence of unmeasured upper-level MY confounding.

All three approaches will produce unbiased estimates of the direct and indirect effects under data-generating mechanism (7), but in contrast to the difference approach, the separate W-only approach and Joint modelling approach also require modelling (and hence potentially correct specification of) the main effect of Di.

5 Simulation study

To gain insight into the finite sample performance of all four modelling approaches represented by eqs (11), (13) and (14), we compare them through simulations. For simplicity, we assume no measured subject-specific confounders D that moderate the treatment or mediator effect.

We consider three different simulation settings, which are defined as special cases of a general data-generating mechanism, specified by the following models for M and Y:

(15)Mit=δM+αXit+κMt+νMViXit+Vi+εMitYit=δY+ζXit+βMit+ϕXitMit+κYt+Ui+εYit

Here, Vi and Ui represent zero-mean bivariate normally distributed unmeasured individual-level confounders, with a variance of 4 and covariance σVi,Ui. We generated independently and normally distributed error terms εMit and εYit, with mean zero and variance 9 and 16 respectively. As deviations from normality for either the individual-level confounders or the lower-level error terms have little or no effect [40, 41], we kept these distributions fixed. Results based on misspecified random effects in the data-generating mechanism confirmed that such linear mixed models are very robust against any such incorrect specifications (results not shown). We also generate period effects for both the mediator and outcome (κM and κY, respectively), and an exposure–mediator interaction for the outcome (ϕ) as well as an exposure–“unmeasured confounder” interaction for the mediator (νM). Note that when νM0, assumption (vi) is violated.

For the first simulation setting, the M and Y values are generated according to eq. (15), but with νM and σVi,Ui both set to zero (thus satisfying the assumptions in Section 2.2). The other parameters are fixed, with δM=1, δY=1.5, α=3, ζ=2, β=1, ϕ=2, κM=0.1 and κY=0.2. For the second simulation setting, we allowed for a non-zero covariance term between both upper-level confounders Ui and Vi, with σVi,Ui=0.50. In the third simulation setting, we also considered σVi,Ui=0.50 but in addition set the parameter value of νM to 1 (thus violating assumption (vi) in Section 2.2).

To get an indication of how the four different modelling approaches are affected by sample size, we considered samples of size N=50 and N=200. Together, these varying factors yield six conditions (three simulation settings and two sample sizes) for which 500 data sets were generated.

For each method, the average value, empirical standard error and the coverage of the 95% confidence intervals of the β, ζ and ϕ estimators are provided. Note that the respective estimators for β, ζ and ϕ are given by bˆ, cˆ and fˆ, for all approaches (eqs (11) (13), and (14)). Additionally, the square root of the mean squared error (MSE) is provided for these estimators. The results for N=50 and N=200 are shown in Table 1. The parameters in this table that show significant bias (as indicated by a significant deviation of the empirical mean from the true mean) are marked in boldface.

Table 1:

Results of fitting each of the four within-subject modelling approaches for the simulated data for N=50 (upper table) and for N=200 (lower table).

NMethodβ=1.00ζ=2.00Φ=2.00
Mean (se)CovMSEMean (se)CovMSEMean (se)CovMSE
50Naive–1.00 (0.18)93.400.181.93 (1.02)96.401.022.00 (0.23)94.600.23
Sep-W–1.01 (0.24)96.400.241.94 (1.18)95.201.182.00 (0.27)95.400.27
Joint–1.01 (0.24)84.600.241.94 (1.11)94.201.112.00 (0.23)94.800.23
(1)Diff–1.01 (0.24)96.400.241.94 (1.18)95.201.182.00 (0.27)95.400.27
50Naive–0.86 (0.18)86.000.231.51 (1.03)94.201.142.00 (0.23)94.600.23
Sep-W–1.01 (0.24)96.400.241.94 (1.18)95.201.182.00 (0.27)95.400.27
Joint–1.01 (0.23)84.800.231.95 (1.12)94.201.122.00 (0.23)94.800.23
(2)Diff–1.01 (0.24)96.400.241.94 (1.18)95.201.182.00 (0.27)95.400.27
50Naive–0.85 (0.18)85.200.231.50 (0.92)94.001.052.00 (0.20)94.200.20
Sep-W–1.01 (0.26)96.400.261.94 (1.02)95.801.022.00 (0.23)95.400.23
Joint–1.03 (0.25)81.000.251.89 (0.99)94.601.002.03 (0.20)94.000.20
(3)Diff–1.01 (0.26)96.400.261.94 (1.02)95.801.022.00 (0.23)95.400.23
200Naive–1.00 (0.08)96.400.081.98 (0.54)93.600.542.00 (0.11)96.600.1
Sep-W–1.00 (0.11)95.800.111.98 (0.62)93.600.622.00 (0.13)96.400.13
Joint–1.00 (0.11)88.200.111.98 (0.59)91.600.592.00 (0.11)96.400.11
(1)Diff–1.00 (0.11)95.800.111.98 (0.62)93.600.622.00 (0.13)96.400.13
200Naive–0.86 (0.08)64.600.161.57 (0.54)88.800.692.00 (0.11)97.400.11
Sep-W–1.00 (0.11)95.800.111.98 (0.62)93.600.622.00 (0.13)96.400.13
Joint–1.00 (0.11)88.200.111.98 (0.59)91.000.592.00 (0.11)97.400.11
(2)Diff–1.00 (0.11)95.800.111.98 (0.62)93.600.622.00 (0.13)96.400.13
200Naive–0.86 (0.08)61.800.161.56 (0.49)85.600.662.00 (0.10)96.200.10
Sep-W–1.00 (0.12)95.800.121.98 (0.53)93.800.532.00 (0.11)95.600.11
Joint–1.02 (0.11)83.600.111.93 (0.53)92.600.532.03 (0.10)94.600.10
(3)Diff–1.00 (0.12)95.800.121.98 (0.53)93.800.532.00 (0.11)95.600.11

5.1 Parameter estimates

As expected, the naive modelling approach provides unbiased estimates of the β, ζ and ϕ parameters for both sample sizes, as long as no unmeasured confounding of the MY relation is present (first data-generating mechanism). As soon as a non-zero covariance between Vi and Ui is present, we observe bias in the parameter estimators bˆ and cˆ, but not in fˆ. The difference and separate W-only modelling approaches yield unbiased estimators for all three effects of interest, irrespective of the data-generating mechanism or sample size (so even when assumption (vi) is violated). Moreover, both methods provide identical estimators for β, ζ and ϕ. This equivalence in estimates form the difference and separate W-only modelling approach is expected when there are no random slopes [37]. Lastly, the joint modelling approach performs rather well in terms of bias, except for the estimators obtained under the third simulation setting (where assumption (vi) is violated) for the larger sample size, where we find significant bias for all three parameters. This bias follows from the arguments provided in Section 3.5, as the assumption of no moderation of Mit by uYi (condition (c)) is violated under the third setting (νM0).

5.2 Coverage and MSE

First of all, as long as the parameter estimates themselves are unbiased, we observe good coverages for all modelling approaches and all parameters. One exception is the low coverage of the estimator for β, obtained by the joint modelling approach. However, this undercoverage improves as the sample size increases. The separate W-only and difference approaches differ slightly in their estimated standard errors (even though the empirical standard error is the same), with the separate W-only approach yielding the largest, and the difference approach providing the smallest.

Second, as long as there is no unmeasured confounding of the MY relation, we observe the lowest MSE for the naive modelling approach. As soon as such confounding is introduced, however, the MSE of the naive approach increases to a level at least as high as the MSEs of the other three approaches. Overall, of these three methods the joint modelling approach seems to provide the lowest MSEs, while the other two collectively yield the highest. This is not surprising, considering that the joint modelling approach is based on maximum likelihood under a more restrictive model.

6 Analysis of a neurostimulation experiment

We applied the different estimation approaches discussed in this paper to data from a recent crossover study in behavioural neuroscience [42]. This crossover study evaluates the effect of anodal transcranial direct current stimulation (tDCS) over the dorsolateral prefrontal cortex on the occurrence of self-referent thoughts, in 32 healthy participants. This neuromodulatory technique applies a weak electric current during 20 min (through the use of electrodes), which induces polarization shifts in the resting membrane potential [43]. It was postulated that tDCS-exposure (X=1 for tDCS stimulation, X=0 for placebo stimulation) affected the outcome (self-referent thoughts) by inducing changes in the ability to shift from negative representations in the working memory (the mediator). The washout period lasted for a minimum of 48 h, and since current research suggests an intersession interval of 48 h after a long stimulation is more than sufficient [44], the absence of carryover effects is very plausible here. With respect to the assumptions, we mentioned earlier that some of the estimation approaches can deal with unmeasured MY confounding at the upper level, in contrast to such confounding at the lower level. To assess robustness against violations of this “no unmeasured confounding” assumption at the lower level, a sensitivity analysis will be presented at the end of this section.

For all approaches, we start from simple estimation without interactions but accounting for period effects. The direct and indirect effect estimates tied to these models, alongside their 95% confidence intervals (these estimates and their 95% percentile-based confidence intervals were obtained through bias-corrected bootstrapping, based on 1,000 bootstrap samples), can be found at the left panel of Figure 4(a). The estimates of the naive multilevel modelling method stand out clearly, which may imply that there is indeed unmeasured individual-level confounding present. Such confounding can be captured by the correlation between both random intercepts from the joint modelling approach and is estimated at –0.43 (p=0.31). If such unmeasured confounding is indeed present, the naive method produces biased estimates, in contrast to the other three approaches (provided the corresponding models hold). As we have not yet included any nonlinearities in our models at this point, the three other methods yield almost identical results.

Figure 4: (a) Results of fitting each of the four within-subject modelling approaches for the neurostimulation data, according to the settings summarized by eq. (3). “Naive”, “joint”, “sep-W” and “diff” represent the four different modelling approaches: the separate modelling, joint modelling, separate W-only modelling and difference approach, respectively. For each method applied to each setting, the estimated direct effect and indirect effect are given, alongside the 95%$$95\% $$ confidence intervals (these estimates and confidence intervals are obtained by percentile-based bias-corrected bootstrapping, based on 1,000 samples). (b) Results of fitting each of the four within-subject modelling approaches for the neurostimulation data, according to the settings summarized by eq. (7) (with ϕ=0$$\phi = 0$$).
Figure 4:

(a) Results of fitting each of the four within-subject modelling approaches for the neurostimulation data, according to the settings summarized by eq. (3). “Naive”, “joint”, “sep-W” and “diff” represent the four different modelling approaches: the separate modelling, joint modelling, separate W-only modelling and difference approach, respectively. For each method applied to each setting, the estimated direct effect and indirect effect are given, alongside the 95% confidence intervals (these estimates and confidence intervals are obtained by percentile-based bias-corrected bootstrapping, based on 1,000 samples). (b) Results of fitting each of the four within-subject modelling approaches for the neurostimulation data, according to the settings summarized by eq. (7) (with ϕ=0).

In a second step, we check for moderation effects of a centred subject-specific baseline confounder D (representing trait rumination, a stable subject-specific measure), in the models for the mediator and outcome, as well as an XM interaction in the model for the outcome. From the models based on the difference approach, we find evidence for an interaction between X and D in both the mediator (p=0.018) and outcome equations (p=0.054), as well as an interaction between M and D in the outcome equation (p=0.0057). In contrast, the exposure–mediator interaction in the outcome model is not significant (p=0.92), and for this reason excluded from the model. As mentioned before, the direct and indirect effect under this assumed data-generating mechanism do not depend on the main effect of D, nor on the period effects and the unobserved Ui. An estimate of the direct and indirect effect at average values of trait rumination (d=0) accompanied by their 95% confidence intervals is provided on the right side of Figure 4(b). We observe no significant indirect and direct effects at d=0, except for the naive modelling approach; once again, the estimates from this approach stand out. Note that the separate W-only and difference approaches again yield identical results for both causal effects, while the joint modelling approach provides somewhat different estimates in the presence of the above-mentioned interactions. This most likely results from the presence of MD interactions, as the linearity assumptions for uYi might be violated in the joint modelling approach (see supporting Appendix A.2). It is also worth mentioning that with the additional inclusion of D and its interactions, the joint modelling approach now yields a correlation of –0.21 (p = 0.58) between both random intercepts, which is already closer to zero.

Additionally, a plot is provided for the direct and indirect effects obtained from the difference approach, over the total range of values for trait rumination (ranging from –11.87 to 37.13, see upper panel in Figure 5(a)). As hypothesized, significant indirect effects are only observed for high levels of trait rumination [42]. A period-averaged direct effect, on the other hand, remains absent over the entire range of D-values.

Figure 5: (a) The average direct (on the left) and indirect effect (on the right) and their 95%$$95\% $$ confidence intervals (95%$$95\% $$ CI) obtained from the difference approach (by percentile-based bias-corrected bootstrapping, based on 1,000 samples), over the total range of values for trait rumination D∈[−11.87,7.13]$$D \in [- 11.87,7.13]$$. (b) The average direct (on the left) and indirect effect (on the right) and their 95%$$95\% $$ confidence intervals (95%$$95\% $$ CI)) at D=22.38$$D = 22.38$$ (=2$$ = 2$$ standard deviations above the mean), over a range of values for the sensitivity parameter ρ∈[−1,1]$$\rho \in [- 1,1]$$ (the estimates, alongside their 95%$$95\% $$ confidence intervals were obtained through percentile-based bias-corrected bootstrapping, based on 1,000 samples).
Figure 5:

(a) The average direct (on the left) and indirect effect (on the right) and their 95% confidence intervals (95% CI) obtained from the difference approach (by percentile-based bias-corrected bootstrapping, based on 1,000 samples), over the total range of values for trait rumination D[11.87,7.13]. (b) The average direct (on the left) and indirect effect (on the right) and their 95% confidence intervals (95% CI)) at D=22.38 (=2 standard deviations above the mean), over a range of values for the sensitivity parameter ρ[1,1] (the estimates, alongside their 95% confidence intervals were obtained through percentile-based bias-corrected bootstrapping, based on 1,000 samples).

6.1 A sensitivity analysis for omitted lower-level MY confounding

While the assumption of “no unmeasured upper-level MY confounding” is not necessary, the absence of unmeasured lower-level confounding of the MY relation remains essential for unbiased estimation of the direct and indirect effect. In this section, we present a sensitivity analysis that is able to assess the impact of such lower-level MY confounding. More precisely, we assume the following extension of data-generating mechanism (7):

(16)Mit=δM+αXit+κMt+ωMDi+νMDiXit+g(Ui)+εMitYit=δY+ζXit+βMit+ϕXitMit+κYt+ωYDi+νYDiXit+ηDiMit+Ui+θεMit+εYit

where θ represents the influence of the lower-level residuals from the mediator equation on the outcome. Values of θ different from zero imply violation of the “no unmeasured lower-level MY confounding” assumption. Note that in our neurobehavioural example, ϕ is assumed to be zero, but is included here to allow for generalization. In terms of differences it follows from eq. (16) that

(17)MiDif=α+κMtiDif+νMDi+εMiYiDif=ζ+βMiDif+ϕXMiDif+κYtiDif+νYDi+ηDiMiDif+θεMi+εYi

with εMi and εYi encoding the difference in M- and Y-residuals from eq. (16). When εMi is substituted by MiDifακMtiDifνMDi in the outcome equation, we obtain

(18)YiDif=(ζθα)+(β+θ)MiDif+ϕXMiDif+(κYθκM)tiDif+(νY+θνM)Di+ηDiMiDif+εYi

which can be rewritten as

(19)YiDif=ζ+βMiDif+ϕ(XM)iDif+κYtiDif+νYDi+ηDiMiDif+εYiwhere:{ζ=ζ+θαβ=βθκY=κY+θκMνY=νY+θνM

As such, under data-generating mechanism (16), the difference approach based on model (11) would result in biased parameter estimators for the effects on the outcome, with bias depending on the value of θ. To simplify interpretation, we will use a sensitivity parameter ρ, representing the correlation between the residual error terms in eq. (17) (εMi and θεMi+εYi), rather than θ [11]. It can be shown that

(20)θ=ρ1ρ2σεYσεM

Under the above setting, the sensitivity analysis then proceeds as follows. First, all parameters in the difference eq. (11) are estimated and the estimates for the residual error variances, σεM and σεY, are determined, assuming that θ=0. Next, a plausible range of values of ρ (varying between –1 and 1) is considered while keeping σεM and σεY fixed, so that θ can be calculated by applying expression (20). Then, relying on the estimate for θ, the estimated parameters from eq. (11) and the equalities on the right side of eq. (19), estimates for the true parameters can be obtained. Additionally, precision of the resulting direct and indirect effect at different values of ρ can be assessed by bootstrapping procedures.

We will now illustrate the above proposed sensitivity analysis on our neurobehavioural data. More specifically, we look at the estimated indirect effect for large values of trait rumination (at D=2 standard deviations above the mean =22.38), since Figure 5(a) revealed that this effect exists but for high values of D. At this value for D, we investigate how extensive the amount of unmeasured MY confounding at the lower level must become in order for the indirect effect to vanish. For values of ρ ranging from –1.00 to 1.00, we estimate the direct and indirect effect (results are shown in lower panel, Figure 5(b)). We observe that the indirect effect disappears when unmeasured lower-level covariates induce a residual correlation between M and Y larger than 0.20.

7 Discussion

In this paper we presented and compared different modelling strategies for the estimation of the direct and indirect effect in crossover studies. First and foremost, since the absence of unmeasured upper-level MY confounding can never be guaranteed, we do not recommend the naive modelling approach in any setting. Furthermore, we showed that the joint modelling method relies on stronger modelling assumptions than the difference or separate W-only modelling approaches. The latter two approaches yield identical estimators in the absence of exposure–mediator interactions. In the presence of both exposure–mediator interactions and interactions with measured subject level confounders D, we have shown how to obtain unbiased direct and indirect effects at specific levels of D, even when D is correlated with unmeasured confounders. In general, the difference approach is simpler to apply and might for this reason prove more accessible to researchers unfamiliar with mixed-effects models.

From a practical perspective, it is important to have clarified the underlying assumptions of each of the different approaches here. Note that easily accessible software for mediation analysis in the multilevel setting, such as the R mediation package [45], relies on separate linear mixed models for the mediator and outcome (if both are measured at the interval level). Considering our findings, these will only yield valid inference under unmeasured upper-level MY confounding, when the subject-specific deviation scores for the mediator are used in the outcome equation model. While we focused on linear settings in this paper, the aforementioned mediation package additionally tackles non-linear multilevel settings. The question of whether or not the approach of Imai et al. [11] yields unbiased estimators for the direct and indirect effects in the presence of unmeasured subject-level confounders in non-linear settings remains to be explored. However, separating within- and between-effects in mixed models with log- or logit-links may yield inconsistent within-subject effects in the presence of unmeasured subject-specific confounders [37]. We conjecture that the mediation package approach in the multilevel setting may require assumptions that are too stringent, even if centred predictors were used. Other estimation approaches may thus be indicated: e.g. conditional generalized estimating equations (CGEE) provide a more general framework for sheltering the estimation of within-subject effects from unmeasured between-subject confounding factors [37].

Throughout this paper, we remained silent about the incorporation of measured lower-level confounders. Although at first sight it may seem very straightforward to incorporate such confounders in the four approaches we discussed, their inclusion requires additional thought. Assumption (iv), for example, dictates that measured within-subject confounders from the second period ought to be unaffected by the exposure (or the mediator) of the first period. If violated, we end up with time-dependent or intermediate confounding. It remains to be investigated how techniques such as inverse probability weighting [46] or G-estimation [47], that can deal with intermediate confounding concerning the estimation of the controlled direct effect in single-level settings, could be applied to multilevel settings.

Appendix

A.1 A.1 Identification of the causal effects in simple settings

We start from a more general data-generating mechanism (compared to model (3)), which relaxes assumption (vii):

(21)Mit=δM+αiXit+κMit+g(Ui)+εMitYit=δY+ζiXit+βiMit+κYit+Ui+εYit

Note that the AB/BA design with a single measurement in each of the two conditions does not allow identification of such heterogeneous effects. This set of eq. (21), however, encompasses the restrictions dictated by this design (and therefore also eq. (3)). Based on this generalized data-generating mechanism summarized in expression (21), the “it-th”-specific TNIE can be identified, when the assumptions (i)(vi) from Section 2.2 are satisfied:

(22)E[Yit(x,Mit(x))Yit(x,Mit(x))|αi,κMi,βi,ζi,κYi,Ui]=m{E[Yit|Xit=x,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=x,αi,κMi,Ui)E[Yit|Xit=x,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=x,αi,κMi,Ui)}=m(dY+ζix+βim+κYit+Ui){P(Mit=m|Xit=x,αi,κMi,Ui)P(Mit=m|Xit=x,αi,κMi,Ui)}=βimmP(Mit=m|Xit=x,αi,κMi,Ui)mmP(Mit=m|Xit=x,αi,κMi,Ui)=βi{E[Mit|Xit=x,αi,κMi,Ui]E[Mit|Xit=x,αi,κMi,Ui)]=βi{dM+αix+κMit+g(Ui)dMαixκMitg(Ui)}=αiβi(xx)

Similarly, the “it-th” specific PNDE can be identified (based on eq. (21)):

(23)E[Yit(x,Mit(x))Yit(x,Mit(x))|αi,κMi,βi,ζi,κYi,Ui]=m{E[Yit|Xit=x,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=x,αi,κMi,Ui)E[Yit|Xit=x,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=x,αi,κMi,Ui)}=mP(Mit=m|Xit=x,αi,κMi,Ui))(δY+ζix+βim+κYit+UiδYζixβimκYitUi)=mP(Mit=m|Xit=x,i)(xx)(ζi)=ζi(xx)

Finally, the “it-th”-specific TCE can be identified as (based on eq. (21)):

(24)E[Yit(x,Mit(x))Yit(x,Mit(x))|αi,κMi,βi,ζi,κYi,Ui]=m{E[Yit|Xit=x,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=x,αi,κMi,Ui)E[Yit|Xit=x,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=x,αi,κMi,Ui)}=m(δY+βim+ζix+κYit+Ui)P(Mit=m|Xit=x,αi,κMi,Ui)m(δY+βim+ζix+κYit+Ui)P(Mit=m|Xit=x,αi,κMi,Ui)=ζi(xx)+βimmP(Mit=m|Xit=xCit=c,αi,κMi,Ui)βimmP(Mit=m|Xit=xCit=c,αi,κMi,Ui)=ζi(xx)+βi(dM+αix+κMit+g(Ui))βi(dM+αix+κMit+g(Ui))=(αiβi+ζi)(xx)

Consequently, the subject- and period-specific TCE equals:

(25)E[Yit(1,Mit(1))Yit(0,Mit(0))|αi,κMi,βi,ζi,κYi,Ui]=m{E[Yit|Xit=1,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=1,αi,κMi,Ui)E[Yit|Xit=0,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=0,αi,κMi,Ui)}=αiβi+ζi

The individual- and period-specific TNIE and PNDE in turn equal

(26)E[Yit(1,Mit(1))Yit(1,Mit(0))|αi,κMi,βi,ζi,κYi,Ui]=m{E[Yit|Xit=1,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=1,αi,κMi,Ui)E[Yit|Xit=1,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=0,αi,κMi,Ui)}=αiβi

and

(27)E[Yit(1,Mit(0))Yit(0,Mit(0))|αi,κMi,βi,ζi,κYi,Ui]=m{E[Yit|Xit=1,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=0,αi,κMi,Ui)E[Yit|Xit=0,Mit=m,βi,ζi,κYi,Ui]P(Mit=m|Xit=0,αi,κMi,Ui)}=ζi

These effects are in line with results from traditional lower-level mediation analysis in linear settings [7]. When we marginalize these effects over individuals, we obtain a TNIE of E[αiβi]=E[αi]E[βi]+Cov(αi,βi)=E[αi]E[βi]+σαi,βi, a PNDE of E[ζi] and a TCE of E[αi]E[βi]+σαi,βi+E[ζi]. However, in an AB/BA design with only two repeated measurements, not all subject-specific effects in model (3) can be identified. This is why we will assume homogeneous effects across subjects, i.e. αi=α, βi=β, ζi=ζ, κMi=κM and κYi=κY, resulting in data-generating mechanism (3). When subject-specific slopes are absent, the indirect and direct effect then simplify to αβ and ζ. If there were more repeated measurements per individual (e.g. four, with two observations within each measurement period), these heterogeneous effects across individuals could become identifiable.

A.2 A.2 Limitations of the joint modelling approach

The joint modelling approach may provide biased estimates under some circumstances, even if the fixed effects part of the model is correctly specified. To understand this, note that the joint modelling approach implies that

E(Yit|Mix=0,Mix=1,Xit)=dYi+cXit+bMit+KYt+E(uYi|Mix=0,Mix=1,Xit)

where

E(uYi|Mix=0,Mix=1,Xit)=E(uYi|MiDif,MiSum,Xit)=E(uYi|MiSum,Xit)

because MiDif is independent of uMi and therefore also of uYi. When uYi and MiSum have bivariate normal distributions (given Xit), this implies that E(uYi|MiSum,Xit) is linear in MiSum. It thus follows that the joint modelling approach is equivalent with fitting GEE to a marginal model that, besides linear terms in Xit,Mit and t, also involves a linear term in MiSum. The assumption that uYi and MiSum have bivariate normal distributions (given Xit) implies in particular that (a) uYi is normal, given Xit; (b) Mit is normal given Xit and uYi; and (c) uYi has a linear, additive effect on Mit (no interactions). When these conditions are not satisfied, then E(uYi|MiSum,Xit) may be nonlinear in MiSum, in which case the joint modelling approach amounts to fitting a misspecified marginal model.

Violations of condition (c) arise in the third data-generating mechanism in our simulations: here, Vi in eq. (7) depends linearly on Ui, but non-linearly on Mit (through the interaction between Vi and Xit), thereby inducing a nonlinear dependence between uYi and MiSum.

A.3 A.3 Identification of the causal effects in complex settings

For the more complex data-generating mechanism, summarized by eq. (7), the “it-th”-specific TNIE can also be identified, when the assumptions (i)(vii) from Section 2.2 are satisfied:

(28)E[Yit(x,Mit(x))Yit(x,Mit(x*))|Di=d,Ui]=m{E[Yit|Xit=x,Mit=m,Di=d,Ui]P(Mit=m|Xit=x,Di=d,Ui)E[Yit|Xit=x,Mit=m,Di=d,Ui]P(Mit=m|Xit=x*,Di=d,Ui)}=m(δY+ζx+βm+ϕxm+κYt+ωYd+νYdx+ηdm+Ui){P(Mit=m|Xit=x,Di=d,Ui)P(Mit=m|Xit=x*,Di=d,Ui)}=(β+ϕx+ηd){mmP(Mit=m|Xit=x,Di=d,Ui)
mmP(Mit=m|Xit=x,Di=d,Ui)}=(β+ϕx+ηd){E(Mit|Xit=x,Di=d,Ui)E(Mit|Xit=x,Di=d,Ui)}=(β+ϕx+ηd)(δM+αx+κMt+ωMd+νMdx+g(Ui)δMαxκMtωMdνMdxg(Ui))=(α+νMd)(β+ϕx+ηd)(xx)

Similarly, the “it-th”-specific PNDE can be identified (based on eq. (7)):

(29)E[Yit(x,Mit(x))Yit(x,Mit(x))|Di=d,Ui]=m{E[Yit|Xit=x,Mit=m,Di=d,Ui]P(Mit=m|Xit=x,Di=d,Ui)E[Yit|Xit=x,Mit=m,Di=d,Ui]P(Mit=m|Xit=x,Di=d,Ui)}=mP(Mit=m|Xit=x,Di=d,Ui)(δY+ζx+βm+ϕxm+κYt+ωYd+νYdx+ηdm+UiδYζxβmϕxmκYtωYdνYdxηdmUi)={(ζ+νYd)mP(Mit=m|Xit=x,Di=d,Ui)+ϕmmP(Mit=m|Xit=x,Di=d,Ui)}(xx)=(ζ+νYd+ϕE[Mit=m|Xit=x,Di=d,Ui])(xx)=(ζ+νYd+ϕ(δM+αx+κMt+λMc+ωMd+νMdx+g(Ui))(xx)

Finally, the “it-th”-specific TCE can be identified as (based on eq. (7)):

(30)E[Yit(x,Mit(x))Yit(x,Mit(x))|Di=d,Ui]=m{E[Yit|Xit=x,Mit=m,Di=d,Ui]P(Mit=m|Xit=x,Di=d,Ui)E[Yit|Xit=x,Mit=m,Di=d,Ui]P(Mit=m|Xit=x,Di=d,Ui)}=m(δY+ζx+βm+ϕxm+κY+ωYd+νYdx+ηdm+Ui)P(Mit=m|Xit=x,Di=d,Ui)m(δY+ζx+βm+ϕxm+κYt+ωYd+νYdx+ηdm+Ui)P(Mit=m|Xit=x,Di=d,Ui)=(ζ+νYd)(xx)+(β+ϕx+ηd)mmP(Mit=m|Xit=x,Di=d,Ui)(β+ϕx+ηd)mmP(Mit=m|Xit=x,Di=d,Ui)=(ζ+νYd)(xx)+(β+ϕx+ηd)(δM+αx+κMt+ωMd+νMdx+g(Ui))(β+ϕx+ηd)(δM+αx+κMt+ωMd+νMdx+g(Ui))=((α+νMd)(β+ηd)+ζ+νYd+ϕ(dM+κMt+ωMd+g(Ui)))(xx)+ϕ(α+νMd)(x2x2)

References

1. BaronRM, KennyDA. The moderator-mediator variable distinction in social psychological research: conceptual, strategic, and statistical considerations. J Pers Soc Psychol1986;51:117382.10.1037/0022-3514.51.6.1173Search in Google Scholar

2. LoeysT, MoerkerkeB, De SmetO, BuysseA, SteenJ, VansteelandtS. Flexible mediation analysis in the presence of nonlinear relations: beyond the mediation formula. Multivar Behav Res2013;48:87194.10.1080/00273171.2013.832132Search in Google Scholar PubMed

3. MackinnonDP, DwyerJH. Estimating mediated effects in prevention studies. Eval Rev1993;17:14458.10.1177/0193841X9301700202Search in Google Scholar

4. SennS. Cross-over trials in clinical research. New York: John Wiley & Sons, 2002.10.1002/0470854596Search in Google Scholar

5. BauerDJ, PreacherKJ, GilKM. Conceptualizing and testing random indirect effects and moderated mediation in multilevel models: new procedures and recommendations. Psychol Methods2006;11:14263.10.1037/1082-989X.11.2.142Search in Google Scholar PubMed

6. JuddCM, KennyDA, McClellandGH. Estimating and testing mediation and moderation in within-subject designs. Psychol Methods2001;6:11534.10.1037/1082-989X.6.2.115Search in Google Scholar

7. KennyDA, KorchmarosJD, BolgerN. Lower level mediation in multilevel models. Psychol Methods2003;8:11528.10.1037/1082-989X.8.2.115Search in Google Scholar PubMed

8. PituchKA, StapletonLM. Distinguishing between cross- and cluster-level mediation processes in the cluster randomized trial. Soc Methods Res2012;41:63070.10.1177/0049124112460380Search in Google Scholar

9. PreacherKJ, ZyphurMJ, ZhangZ. A general multilevel SEM framework for assessing multilevel mediation. Psychol Methods2010;15:20933.10.1037/a0020141Search in Google Scholar PubMed

10. RaykovT, MelsG. Lower level mediation effect analysis in two-level studies: a note on a multilevel structural equation modeling approach. Struct Equ Model2007;14:63648.10.1080/10705510701575511Search in Google Scholar

11. ImaiK, KeeleL, TingleyD. A general approach to causal mediation analysis. Psychol Methods2010;15:30934.10.1037/a0020761Search in Google Scholar PubMed

12. PearlJ. Direct and indirect effects. Proceedings of the Seventeenth Conference on Uncertainty in Artificial Intelligence, San Francisco, CA: Morgan Kaufmann 2001, 41120.Search in Google Scholar

13. PearlJ. The causal mediation formula-a guide to the assessment of pathways and mechanisms. Prev Sci2012;13:42636.10.1007/s11121-011-0270-1Search in Google Scholar PubMed

14. VanderWeeleT, VansteelandtS. Conceptual issues concerning mediation, interventions and composition. Stat Interface2009;2:45768.10.4310/SII.2009.v2.n4.a7Search in Google Scholar

15. VanderWeeleTJ. Direct and indirect effects for neighborhood-based clustered and longitudinal data. Soc Methods Res2010;38:51544.10.1177/0049124110366236Search in Google Scholar PubMed PubMed Central

16. RubinD. Bayesian inference for causal effects: the role of randomization. Ann Stat1978;6:3458.10.1214/aos/1176344064Search in Google Scholar

17. RobinsJ, GreenlandS. Identifiability and exchangeability for direct and indirect effects. Epidemiology1992;3:1535.10.1097/00001648-199203000-00013Search in Google Scholar PubMed

18. HafemanDM, SchwartzS. Opening the black box: a motivation for the assessment of mediation. Int J Epidemiol2009;38:83845.10.1093/ije/dyn372Search in Google Scholar PubMed

19. VanderWeeleTJ. A three-way decomposition of a total effect into direct, indirect, and interactive effects. Epidemiology2013;24:22432.10.1097/EDE.0b013e318281a64eSearch in Google Scholar PubMed PubMed Central

20. RobinsJ, RichardsonT. Alternative graphical causal models and the identification of direct effects. In: ShroutK, KeyesP, OrnsteinK, editors. Causality and psychopathology: finding the determinants of disorders and their cures, 100. Oxford: Oxford University Press, 2011, chapter 6: 152.Search in Google Scholar

21. Tucker-DrobEM. Individual differences methods for randomized experiments. Psychol Methods2011;16:298318.10.1037/a0023349Search in Google Scholar PubMed PubMed Central

22. PaltaM, YaoT, VeluR. Testing for omitted variables and non-linearity in regression models for longitudinal data. Stat Med1994;13:221931.10.1002/sim.4780132104Search in Google Scholar PubMed

23. PearlJ. An introduction to causal inference. Int J Biostat2010;6:Article 7.Search in Google Scholar

24. CollinsL, GrahamJ, FlahertyB. An alternative framework for defining mediation. Multivar Behav Res1998;33:295312.10.1207/s15327906mbr3302_5Search in Google Scholar PubMed

25. HayesAF. Beyond Baron and Kenny: statistical mediation analysis in the new millennium. Commun Monogr2009;76:40820.10.1080/03637750903310360Search in Google Scholar

26. MacKinnonDP, KrullJL, LockwoodCM. Equivalence of the mediation, confounding and suppression effect. Prev Sci2000;1:17381.Search in Google Scholar

27. PreacherKJ, RuckerDD, HayesAF. Addressing moderated mediation hypotheses: theory, methods, and prescriptions. Multivar Behav Res2007;42:185227.10.1080/00273170701341316Search in Google Scholar PubMed

28. ZhaoX, Lynch Jr JG, ChenQ. Reconsidering Baron and Kenny: myths and truths about mediation analysis. J Consumer Res2010;37:197206.10.1086/651257Search in Google Scholar

29. MacKinnonDP. Introduction to statistical mediation analysis. New York: Taylor & Francis Group, LLC, 2008.Search in Google Scholar

30. TofighiD, WestSG, MackinnonDP. Multilevel mediation analysis: the effects of omitted variables in the 1-1-1 model. Br J Math Stat Psychol2013;66:290307.10.1111/j.2044-8317.2012.02051.xSearch in Google Scholar PubMed PubMed Central

31. BeggMD, ParidesMK. Separation of individual-level and cluster-level covariate effects in regression analysis of correlated data. Stat Med2003;22:2591602.10.1002/sim.1524Search in Google Scholar PubMed

32. KenwardMG, RogerJH. The use of baseline covariates in crossover studies. Biostatistics (Oxford, England)2010;11:117.10.1093/biostatistics/kxp046Search in Google Scholar PubMed

33. LouisT. General methods for analyzing repeated measures. Stat Med1988;7:2945.10.1002/sim.4780070108Search in Google Scholar PubMed

34. NeuhausJ, KalbfleischJ. Between- and within-cluster covariate effects in the analysis of clustered data. Biometrics1998;54:63845.10.2307/3109770Search in Google Scholar

35. ZhangZ, ZyphurMJ, PreacherKJ. Testing multilevel mediation using hierarchical linear models. Organ Res Methods2009;12:695719.10.1177/1094428108327450Search in Google Scholar

36. DavisJ, SpaethJ, HusonC. A technique for analyzing the effects of group composition. Am Soc Rev1961;26:21525.10.2307/2089857Search in Google Scholar

37. GoetgelukS, VansteelandtS. Conditional generalized estimating equations for the analysis of clustered and longitudinal data. Biometrics2008;64:77280.10.1111/j.1541-0420.2007.00944.xSearch in Google Scholar

38. EdwardsJR, LambertLS. Methods for integrating moderation and mediation: a general analytical framework using moderated path analysis. Psychol Methods2007;12:122.10.1037/1082-989X.12.1.1Search in Google Scholar

39. FairchildAJ, MacKinnonDP. A general model for testing mediation and moderation effects. Prev Sci2009;10:8799.10.1007/s11121-008-0109-6Search in Google Scholar

40. McCullochCE, NeuhausJM. Misspecifying the shape of a random effects distribution: why getting it wrong may not matter. Stat Sci2011;26:388402.10.1214/11-STS361Search in Google Scholar

41. VerbekeG, LesaffreE. The effect of misspecifying the random-effects distribution in linear mixed models for longitudinal data. Comput Stat Data Anal1997;23:54156.10.1016/S0167-9473(96)00047-3Search in Google Scholar

42. VanderhasseltM-A, BrunoniAR, LoeysT, BoggioPS, De RaedtR. Nosce te ipsum – Socrates revisited? Controlling momentary ruminative self-referent thoughts by neuromodulation of emotional working memory. Neuropsychologia2013;51:25819.10.1016/j.neuropsychologia.2013.08.011Search in Google Scholar PubMed

43. BrunoniAR, NitscheMA, BologniniN, BiksonM, WagnerT, MerabetL, et al. Clinical research with transcranial direct current stimulation (tDCS): challenges and future directions. Brain Stimulation2012;5:17595.10.1016/j.brs.2011.03.002Search in Google Scholar PubMed PubMed Central

44. NitscheMA, CohenLG, WassermannEM, PrioriA, LangN, AntalA, et al. Transcranial direct current stimulation: state of the art 2008. Brain Stimulation2008;1:20623.10.1016/j.brs.2008.06.004Search in Google Scholar PubMed

45. TingleyD, YamamotoT, HiroseK, KeeleL, ImaiK. mediation: R Package for Causal Mediation Analysis. Journal of Statistical Software 2014;59:1–38.Search in Google Scholar

46. RobinsJM. Testing and estimation of direct effects by reparameterizing directed acyclic graphs with structural nested models. In: GlymourC, CooperG, editors. Computation, causation, and discovery. Menlo Park, CA and Cambridge, MA: AAAI Press/The MIT Press, 1999: 349405.Search in Google Scholar

47. GoetgelukS, VansteelandtS, GoetghebeurE. Estimation of controlled direct effects. J R Stat Soc2009;70:104966.10.1111/j.1467-9868.2008.00673.xSearch in Google Scholar

Published Online: 2015-4-4
Published in Print: 2015-5-1

© 2015 Walter de Gruyter GmbH, Berlin/Boston

Downloaded on 29.3.2024 from https://www.degruyter.com/document/doi/10.1515/ijb-2014-0057/html
Scroll to top button