## 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. 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 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).

## 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.

## 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

## 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.

## 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

## 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).

## 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.

## 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.