Multiple Mediation in Stata

This post will show how to test a mediation model with more than one mediator using Stata. In order to illustrate it, I will build on the example I used in my simple mediation post by adding job anxiety as an additional  mediator of the path between work incentives and job performance . In other words, my hypothesis is that both satisfaction and anxiety in the workplace mediate the relationship between work incentives and job performance.

multiplemed1

CASE 1: No latent variables

Assuming the simple case in which all variables are observed, i.e. there are no latent variables, the following command syntax will fit the mediation model above:

 sem (satisfaction<-incentives)(anxiety<-incentives)(performance<-satisfaction anxiety incentives)

The direct effect of work incentives on job performance is estimated by the coefficient for performance<-incentives, indicated by c’ in the diagram.

Notice that in order to compute the indirect effect we now need to take into account that it is split into two paths, the path through satisfaction (mediator 1) and the path through anxiety (mediator 2).

The indirect effect through job satisfaction is estimated by the product of the coefficient for satisfaction<-incentives (a1) and the coefficient for performance<-satisfaction (b1), which we will the a1b1 product. Likewise, the indirect effect through anxiety is estimated by the product of the coefficient for anxiety<-incentives (a2) and the coefficient for performance<-anxiety (b2). We call this product: a2b2 .

The overall indirect effect is defined as the sum of both products:

Indirect effect = a1b1 + a2b2

Using the nlcom Stata command, already introduced in the previous post, the syntax to compute the individual and overall indirect effect for this example is:

nlcom b[satisfaction:incentives]*b[performance:satisfaction] // through satisfaction
nlcom b[anxiety:incentives]*b[performance:anxiety] // through anxiety
nlcom (b[satisfaction:incentives]*b[performance:satisfaction] + b[anxiety:incentives]*b[performance:anxiety]) // overall indirect effect

The total effect is defined as direct effect plus indirect effect

c=c’+ a1b1 + a2b2

and in Stata syntax, is computed as:

nlcom _b[performance:incentives]+ (b[satisfaction:incentives]*b[performance:satisfaction]+b[anxiety:incentives]*b[performance:anxiety])

Let’s assume now that our study variables are latent, in other words, we measure them through a list of items (e.g. commonly job satisfaction is measured through Likert scale survey questions). Continuing to expand on our previous example, let’s assume that our new construct anxiety is measured by 4 likert-scale questions.

The model with latent variables is drawn as

multiplemed2

The following syntax shows how to incorporate the measurement model into the SEM equations:

sem (satis1 satis2 satis3 satis4 <-Satisfaction) // measurement piece
(incen1 incen2 incen3 <- Incentives) (perf1 perf2 <-Performance) // measurement piece
(anx1 anx2 anx3 anx4 <- Anxiety) //measurement piece
(Satisfaction<-Incentives)(Anxiety<-Incentives)(Performance<-Satisfaction Anxiety Incentives) // structural piece

I would like to end with a final note. Sometimes, the algorithms used to solve these models fail to converge. If several attempts such as changing the algorithm starting values, adding constraints, etc, fail to succeed, a simple way out is to compute the scales for each construct from its corresponding items and use the new scales to fit a SEM model with no latent variables (i.e. no measurement model piece).

Posted in Uncategorized | Leave a comment

Mediation Analysis using Stata: one mediator

In my previous post I introduced what mediation analysis means and how mediation is commonly tested. This post will show how to test a simple mediation model with one mediator using Stata and particularly using Structural Equation Modeling (SEM). In order to illustrate it, I will use the same previous example where job satisfaction mediates the relationship between work incentives and job performance.

Continue reading

Posted in mediation analysis, SEM, Stata syntax, Uncategorized | Tagged , , | Leave a comment

Mediation Analysis: an introduction

Mediation is defined in statistics as a model that tries to explain the mechanism through which an independent variable (X) influences an outcome (Y) via the intervening effect of a third variable, known as mediator or mediating variable (M). It is important to keep in mind that this is a casual model, since it is hypothesized that the M influences Y and not vice versa. Continue reading

Posted in mediation analysis, Uncategorized | Tagged , , , , | Leave a comment

How do I prepare my survival data to conduct analysis in Stata?

Let’s start by what is survival data. Survival data is characterized by having individuals that are observed over a period of time until an event of interest takes place, a.k.a failure. This event can be death, occurrence of a disease, malfunction, etc. If failure does not happen during the observation period the observation is considered censored.

Continue reading

Posted in survival analysis, survival data | Tagged , , , | Leave a comment

Repeated Measures MANCOVA vs Repeated Measures ANCOVA

In a previous post, I wrote about the repeated measures (RM) ANCOVA, which is also commonly referred to as repeated measures MANCOVA. In this post, however, when I use the term repeated measures multivariate analysis of covariance (MANCOVA) I will be referring to a design with multiple dependent variables (DVs) for each of which repeated measures have been taken. It is important to know that the term

Continue reading

Posted in repeated measures mancova | Tagged , , , | 1 Comment

How to test for moderation? (part 2)

If you have not read my previous post ‘How to test for moderation? (part 1)’ I recommend that you do it. In part 2 we are going to address how to test for moderation when both predictor (X) and moderator (M) are continuous (scenario #2), when X is continuous and M is categorical (scenario #3) and when X is categorical and M is continuous (scenario #4).

Continue reading

Posted in interaction, marginal effect, moderation, moderation effect, moderator | Tagged , , , , | Leave a comment

How to test for moderation? (part 1)

Let’s start by defining what moderation means in the context of a regression model or structural equation modeling (SEM). You have probably already tested for moderation without knowing that you were doing something that sounds so sophisticated, because moderation is nothing more than testing for an interaction between a predictor in your model and a covariate such as gender, age, years of experience, etc.

Continue reading

Posted in moderation | Tagged , , , , , , | Leave a comment

Effect size: How to measure it and why is important

The effect size provides an estimate of the magnitude of change. For example, in a research study that estimates the efficacy of a new intervention to improve post surgery recovery after hip replacement, the effect size is a measure of how big is the difference between the treatment and the control or placebo groups, in other words how much larger is the effect of the new intervention versus the standard of care.

Continue reading

Posted in cohen's d, effect size, magnitude of change | Tagged , , | Leave a comment

When do I need to use a repeated measures ANOVA/MANOVA?

Before talking about this technique let’s clarify that when the name repeated measures MANOVA is used it commonly refers to a repeated measures ANOVA in the sense that there is only a single dependent variable or outcome of interest. For example, a researcher who wants to compare different treatments for diabetes has taken 4 weekly measurements of blood sugar to a series of patients.

Continue reading

Posted in MANOVA, repeated measures | Tagged , , , , , , | Leave a comment

Pre-post data: Do I need to use repeated measures in my model?

First of all, let’s define what we mean by pre-post data. The classic pre-post design consists in having measurements for an outcome variable in two time points, usually before and after an intervention or treatment. It is common two have two groups, one which will receive the full intervention and a second one, called the control group, which will receive a partial intervention or none. The interest of the researcher is to determine whether the intervention was effective in improving the levels of the outcome variable.

Continue reading

Posted in ancova, ANOVA, repeated measures | Tagged , , , , | Leave a comment