MLmed User Guide 5 17

MLmed_User_Guide_5_17

MLmed_User_Guide_5_17

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 16

DownloadMLmed User Guide 5 17
Open PDF In BrowserView PDF
MLMED
User Guide
Nicholas J. Rockwood
The Ohio State University
rockwood.19@osu.edu

Beta Version
May, 2017
MLmed is a computational macro for SPSS that simplifies the fitting of multilevel mediation and moderated mediation models, including
models containing more than one mediator. After the model specification, the macro automatically performs all of the tedious data management necessary prior to fitting the model. This includes within-group
centering of lower-level predictor variables, creating new variables containing the group means of lower-level predictor variables, and stacking
the data as outlined in Bauer, Preacher, and Gil (2006) and their supplementary material to allow for the simultaneous estimation of all parameters in the model. The output is conveniently separated by equation,
which includes a further separation of between-group and within-group
effects. Further, indirect effects, including Monte Carlo confidence intervals around these effects, are automatically provided. The index of
moderated mediation (Hayes, 2015) is also provided for models involving level-2 moderators of the indirect effect(s).

1

Contents
1 Scope of MLmed
2 System Requirements
2.1 Note for using SPSS Version 21 . . . . .
2.2 Output Language . . . . . . . . . . . . .
3 Preparation for Use
4 Model Syntax
4.1 Adding Fixed Effects . . . . . . . . . . .
4.1.1 Mediators . . . . . . . . . . . . .
4.1.2 Level-1 Covariates . . . . . . . .
4.1.3 Level-2 Covariates . . . . . . . .
4.1.4 Level-2 Moderators . . . . . . . .
4.2 Removing Fixed Effects . . . . . . . . .
4.2.1 Between-group Effects . . . . . .
4.2.2 Within-group Effect of X . . . . .
4.3 Specifying Random Effects . . . . . . . .
4.3.1 Random Intercepts . . . . . . . .
4.3.2 Random Slopes . . . . . . . . . .
4.4 Covariance Matrices . . . . . . . . . . .
4.4.1 Residual Covariance Matrix . . .
4.4.2 Random Effect Covariance Matrix
4.5 Estimation . . . . . . . . . . . . . . . . .
4.6 Other Specifications . . . . . . . . . . . .
5 Example Syntax
5.1 Random Slopes . . . . . . . . . . . . . .
5.2 Parallel Mediators with Covariates . . .
5.3 Moderated Mediation . . . . . . . . . . .
5.4 2-1-1 Design . . . . . . . . . . . . . . . .
5.5 1-1-1 Design with No Between Effects . .
6 Output
6.1 Errors . . . . . . . . . . . . . . . . . . .
6.2 Model Fit Statistics . . . . . . . . . . . .
6.3 Fixed Effects . . . . . . . . . . . . . . .
6.4 Random Effects . . . . . . . . . . . . . .
6.5 Index of Moderated Mediation . . . . . .
6.6 Indirect Effect(s) . . . . . . . . . . . . .
References

2

. . . . . . . . . . . .
. . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

3
3
3
4
4
4
6
6
6
6
6
7
7
8
8
8
9
9
9
9
10
10
10
11
11
12
12
13
13
13
14
14
14
15
15
15

1

Scope of MLmed

Currently, MLmed is fairly limited in terms of available models relative to
other macros available for mediation, moderation, and conditional process
models, such as PROCESS (Hayes, 2013). MLmed is, in fact, a work in
progress that will be expanded upon as time permits. Generally, these
expansions will be made following research and user recommendations.
In its current form, MLmed can accommodate up to three continuous, parallel mediators and one continuous dependent variable. Up to three level-1
and three level-2 covariates can be included. Finally, one level-2 moderator
of the a path (X → M ) and one level-2 moderator of the b path (M → Y )
can be included. The same variable may moderate both paths. In models
containing more than one mediator, only the a and b paths for the first mediator may be moderated. Further, the direct effect for any model cannot
be moderated. For those familiar with PROCESS (Hayes, 2013), MLmed
can handle multilevel models similar to Models 4, 7, 14, 21, and 58. A
special multilevel type of Model 74 can also be fit.
Within-group and between-group indirect effects can be estimated when X,
M , and Y all have variability at the within-group and between-group levels.
MLmed estimates within-group effects by within-group centering variables
prior to the analysis, and between-group effects are estimated using group
means. The details of this approach can be found in Zhang, Zyphur, and
Preacher (2009).
In connection to the multilevel mediation literature, MLmed can handle 11-1 and 2-1-1 data designs, where the three numbers refer to the lowest
level in which X, M , and Y vary.

2

System Requirements

MLmed is compatible with Windows and Mac Operating Systems for SPSS
Version 21 and higher. For the most user-friendly output, it is recommended
that SPSS Version 22 or higher is used.

3

2.1

Note for using SPSS Version 21

MLmed contains syntax to remove unnecessary additional output provided
by the use of the MIXED function in SPSS. However, this syntax is not
recognized by SPSS versions older than Version 22. As a result, the additional output will not be removed and the output will also contain the
following error code in numerous places:
>Error # 1. Command name: OUTPUT
>The first word in the line is not recognized as an SPSS
Statistics command.
>Execution of this command stops.

This error is simply due to attempts to modify the output display, and is
not an indication of error in the output content. Consequently, users should
ignore the warnings and additional output that is presented and instead
focus on the output discussed in this manual and subsequent publications
and tutorials.

2.2

Output Language

Unfortunately, the use of MLmed when the SPSS Output Language is specified as anything other than English will result in errors. The output language can be changed to English using the Output Language drop-down
menu under the Language header found through Edit → Options....

3

Preparation for Use

Before using MLmed, the syntax file containing the code necessary to define
the macro (MLmed.sps), must be opened and executed without modification. The file can then be closed, and MLmed can be operated using a new
syntax file. Note that the macro will remain active only for the duration
of the SPSS session (i.e., until SPSS is closed). The macro will need to be
re-executed at the start of a new session.

4

4

Model Syntax

Once the macro is activated, it can be called by typing MLmed followed by
the appropriate macro arguments. Each argument, except the first, should
begin with a forward slash, and the final argument should be followed by a
period. The minimum syntax necessary to run the most basic model is:
MLmed data = DataSet1
/x = Xvar
/m1 = Mvar
/y = Yvar
/cluster = group
/folder = FilePath.
where the italicized words are replaced with the correct dataset name, variable names, and file location. The dataset name should be the name that
appears in brackets on the opened dataset window, rather then the saved
.sav file name. By default, the first dataset opened in a new SPSS session
is named DataSet1 and MLmed defaults to this name. To be safe, specify
the correct dataset name, even if it is the default. The x, m1, and y arguments should be the names of the variables in the dataset corresponding
to X, M , and Y . The cluster argument should be a variable that labels
which level-2 unit each row in the dataset belongs to. Finally, the folder
argument should be a file path on the user’s computer. This does not have
to be the location of the dataset, syntax file, or any other specific file, but
must be a correct folder location on the computer. Note that file paths on
a Windows OS will use a backslash between folders, while a Mac OS will
use a forward slash (see Section 5 for examples). The macro arguments do
not have to be in any specific order, other than the folder specification
being last.
This minimum syntax will fit a model where Xvar is the independent
variable, Mvar is the mediator, and Yvar is the dependent variable. The
macro automatically group-mean centers X and uses the group means as
a level-2 predictor of M . Further, group-mean centered X and M are
used as level-1 predictors of Y and the group means of X and M are
used as level-2 predictors. All intercept terms are random. By default,
all slope terms (described in this section and later sections) are fixed and
the random effect covariance matrix is diagonal, where variances are freely
5

estimated and covariances are constrained to zero. These defaults are useful
for increasing the likelihood of convergence. Macro arguments that can
change these specifications are described in a later section.

4.1

Adding Fixed Effects

The basic syntax can be expanded to fit models that include additional fixed
effects that result from adding mediators, covariates, and moderators.
4.1.1

Mediators

Up to two additional mediators can be specified by including the arguments
m2 and m3 with the variable name following. Each mediator included will
be group-mean centered prior to the analysis. The group means will also
be included as predictors to estimate between-group effects.
4.1.2

Level-1 Covariates

Up to three level-1 covariates can be included by using the cov1, cov2,
and cov3 arguments, with the appropriate variable names following. As
with other level-1 variables, the covariates are automatically group mean
centered to disentangle between-group and within-group effects.
4.1.3

Level-2 Covariates

Up to three level-2 covariates can be included by using the L2cov1, L2cov2,
and L2cov3 arguments, with the name of the covariates following. The
user should manually center level-2 covariates prior to using MLmed if desired.
4.1.4

Level-2 Moderators

One level-2 moderator can be specified for the a path, and one level-2 moderator can be specified for the b path. These are specified using the modM
and modY arguments, respectively, where the letters M and Y correspond to
the dependent variable for the equation in which the moderator is included

6

in. The user should NOT include the level-2 moderator as a level-2 covariate, as MLmed will do this automatically. It should also be noted that the
variable is included as a moderator only for the first mediator listed (the
one specified by m1).
By default, the moderation of both the between-group and within-group
effects are tested for each moderator included. The same moderator can be
specified for both paths to allow for the testing of a quadratic moderation
effect. The user can also specify a specific value to center each moderator around using the modMcent and modYcent arguments, respectively.
Any effect that is moderated will be conditional on the value in which the
moderator is centered around (by default, the value is 0).

4.2

Removing Fixed Effects

Some of the effects automatically included by MLmed may be omitted from
the model. These include a number of between-group effects, and also the
within-group effect of X.
4.2.1

Between-group Effects

The general format for removing a between group effect is by listing the
argument to specify the original variable followed by a B and setting this
new argument equal to zero. That is, it can be thought of as specifying that between-group effect to be omitted. For example, removing the
between-group effect of x can be specified using the argument xB = 0.
The between-group effect of cov1 can be omitted using cov1B = 0. Similarly, the between-effects of the M and/or Y moderators can be specified
using modMB = 0 and ModYB = 0, respectively.
There is, however, a slight deviation from this format for removing the
between-group effect(s) of the mediator(s). Rather than the between-group
effect of each mediator being specified with its own argument, the betweengroup effect of all mediators can be specified using mB, which should be a
list of zeros and ones equal in length to the number of mediators where a
1 denotes that the between-group effect of that particular mediator should
be estimated and a 0 denotes it should be omitted. For example, a model
including three mediators where the between-group effect of mediators 1
and 3 on Y is estimated, but the effect of mediator 2 on Y is omitted can
7

be specified using mB = 101.
There are two main reasons one may wish to omit a between-group effect.
The first occurs if there is no actual between-group variability on a given
variable. In this scenario, the group-mean for the variable will be the same
for each group, making the vector of group means redundant. Consequently,
the model cannot be estimated without this effect omitted. The second
reason is simply for parsimony, as the removal of the effect can simplify
the model. This is particularly true with the removal of the between-group
moderator, given that including the moderator makes the indirect effect
conditional. It should be noted that if the between-group effect of X or
one of the mediators is not estimated, the between-group indirect effect
involving that parameter is also not calculated.
4.2.2

Within-group Effect of X

The within-group effect of X can also be omitted using the argument xW =
0. Of course, no within-group indirect effects will then be estimated. The
ability to omit the within-group effect of X expands MLmed to be able to
estimate 2-1-1 multilevel mediation models, as the 2-1-1 model can be seen
as a special case of the 1-1-1 model with no within-group variability on X.

4.3

Specifying Random Effects

Any intercept and/or within-group slope included in the model can be
specified as randomly varying across groups.
4.3.1

Random Intercepts

By default, all intercepts included in the model are specified as random.
Because nonconvergence may be an issue if the variance of a random effect
nears zero, the user can specify any intercept as fixed. For the Y intercept,
this is accomplished using randYint = 0, indicating that a random term
for the Y intercept should be omitted. For M , the argument to omit a
random intercept is randMint, though the exact specification depends on
the number of mediators in the model. A list of zeros and ones that is the
length of the number of mediators should be included, where a zero omits
the random effect and a one estimates it. For example, randMint = 011
8

should be specified to omit the random intercept for the first mediator in
a three mediator model.
4.3.2

Random Slopes

Random slopes can be specified using similar syntax as random intercepts.
To specify the effect of X to be random, the argument randx is used,
which should be a list of binaries of length k + 1 where k is the number of
mediators in the model. The first binary refers to the effect of X on Y (the
c0 path), the second refers to the effect of X on M1 , the third refers to the
effect of X on M2 , and so forth. A 1 corresponds to a random effect, while a
0 corresponds to a fixed effect. Random effects of the mediator(s) on Y are
specified using randm which should be a list of binaries of length k, where
the first refers to the effect of the first mediator on Y , the second refers
to the effect of the second mediator on Y and so forth. Random effects of
level-1 covariates are specified using randc1, randc2, and randc3. The
format of these arguments follow that of randx.

4.4

Covariance Matrices

The residual covariance matrix and the covariance matrix of the random
effects can be modified.
4.4.1

Residual Covariance Matrix

The residual covaraince matrix is specified as diagonal (DIAG) by default,
where the residual variance of each equation is freely estimated and the
covariance between the residuals of each equation are constrained to zero.
The residual covariance matrix can be specified as unconstrained (where
all variances and covariances are freely estimated) using the argument
rescovmat = UN.
4.4.2

Random Effect Covariance Matrix

By default, the random effect covariance matrix is specified as diagonal,
where all variances are freely estimated and the covariances are constrained
to zero. However, some or all of the random effects can be permitted to
9

covary. If there is more than one random slope, their covaraince(s) can be
freely estimated by including the command covmat = UN. To estimated
the covariance between random slopes and the Y intercept, the command
ycov = 1 can be included (if covmat = UN). If more than one mediator
is in the model, the covariance between the random intercepts for the mediators can be estimated using mcovmat = UN. The covariance between
the M and Y intercepts can be included in the model using indint = 0.
If there are random slopes in the model, covmat = UN, ycov = 1, and
indint = 0, then the whole random effect covariance matrix is unstructured, where all variances and covariances are freely estimated.

4.5

Estimation

The default estimator for MLmed is Restricted Maximum Likelihood (REML).
Users may instead estimate the model using Full Maximum Likelihood by
including the argument est = ML. The user may also provide a number of specifications that influence the estimation. These specifications
include iters (maximum number of iterations), mxstep (maximum stephalving), and scoring (number of iterations in which the Fisher scoring
algorithm is used). Further details of these can be found in the SPSS users
manual under the section for MIXED.

4.6

Other Specifications

The user may specify the confidence level used for inferences provided in the
output using the conf argument, which should include a number between
0 and 100 which corresponds to the percentage of confidence. By default,
this value is 95. The number of Monte Carlo samples used can be changed
using samples, which defaults to 10,000. Lastly, when the model fails to
converge the estimates of the parameters is omitted from the output. The
user may override this by specifying eor = 1, which is short for Error
Override. This command can be useful for assessing issues in convergence
by identifying which parameters may be causing the difficulties.

10

5

Example Syntax

This section contains example models to demonstrate the use of some the
syntax arguments described previously. The models presented here are not
exhaustive. The arguments from each of the following example models can
be mixed and matched to correspond to the user’s desired model.

5.1

Random Slopes

MLmed data = DataSet1
/x = Xvar
/randx = 11
/m1 = Mvar
/randm = 1
/y = Yvar
/covmat = UN
/cluster = group
/folder = /Users/username/Desktop/.
Here, randx = 11 specifies that the within-group effects of X on Y and M
randomly vary across upper-level units. The randm = 1 specifies that the
within-group effect of M on Y is also random. The covariance between these
random slopes is estimated using covmat = UN. Finally, the folder
argument is an example of a correct folder on a Mac.

5.2

Parallel Mediators with Covariates

MLmed data = DataSet1
/x = Xvar
/randx = 010
/cov1 = Covvar
/L2cov1 = L2Covvar
/m1 = Mvar1
/m2 = Mvar2
/randm = 10
/mcovmat = UN
/y = Yvar

11

/cluster = group
/folder = C:\Users\rockwood.19\Desktop\.
This model is a parallel mediator model with mediators Mvar1 and Mvar2,
level-1 covariate Covvar, and level-2 covariate L2Covvar. The withingroup effects of X on Y , M1 , and M2 are fixed, random, and fixed, respectively, as defined by randx = 010. Further, the within-group effect of
M1 on Y is random, while the within-group effect of M2 on Y is fixed, as
specified by randm = 10. Estimation of the covariance between the random intercepts for the M1 and M2 equations is requested using mcovmat
= UN.

5.3

Moderated Mediation

MLmed data = DataSet1
/x = Xvar
/randx = 01
/m1 = Mvar
/modM = Modvar
/modMB = 0
/modMcent = 2.3
/y = Yvar
/cluster = group
/folder = /Users/username/Desktop/.
This is a moderated mediation model in which the a path is moderated
by Modvar. By default, the moderation of both the within-group and
between-group effects is estimated. However, the inclusion of modMB =
0 omits the between-group moderation. The moderator is also centered
around 2.3 prior to the analysis using modMcent = 2.3. The residual
variance of the within-group a path is estimated using randx = 01. That
is, the within-group effect of X on M randomly varies after controlling for
Modvar.

5.4

2-1-1 Design

12

MLmed data = DataSet1
/x = Xvar
/xW = 0
/m1 = Mvar
/y = Yvar
/cluster = group
/folder = /Users/username/Desktop/.
This is a standard 2-1-1 design with only random intercepts. It follows
the same sytnax as the basic 1-1-1 design with the exception that the
argument xW = 0 is included to omit the estimation of the within-group
effect of X which, by definition, does not exist (since X has no within-group
variability).

5.5

1-1-1 Design with No Between Effects

MLmed data = DataSet1
/x = Xvar
/xB = 0
/m1 = Mvar
/mB = 0
/y = Yvar
/cluster = group
/folder = /Users/username/Desktop/.
This is the standard 1-1-1 design without the estimation of between-group
effects. The between-group effects of X are omitted using xB = 0, and
the between-group effect of M is omitted using mB = 0. Note that X and
M are still within-group centered prior to the analysis.

6

Output

The MLmed macro provides a very detailed output including individual
parameter estimates, and the estimated indirect effects. In addition, the
index of moderated mediation is included if a moderator is specified. This
section provides an overview on each of the output tables provided.
13

6.1

Errors

If there are any errors when estimating the model, the estimated parameters
are disabled from the output (unless this is overridden). Instead, the user is
provided with the number of fixed effect and random effect parameters that
could not be estimated, as well as a code labeling the specific parameters,
where a 1 indicates the parameter could not be estimated. The user can
use this information to respecify the model.

6.2

Model Fit Statistics

If the model converges, various statistics are provided, such as the sample
size and number of model parameters, as well as several model fit statistics, including -2 times the Log Likelihood (-2LL), Akaike’s Information
Criterion (AIC), Hurvich and Tsai’s Criterion (AICC), Bozdogan’s Criterion (CAIC), and Schwarz’s Bayesian Criterion (BIC). The fit statistics can
be useful when comparing models.

6.3

Fixed Effects

After the model fit statistics, the fixed effect estimates are provided. These
estimates are grouped by each outcome variable, starting with the mediator(s) and ending with Y . Within each section containing each outcome
variable, the effects are broken up by within-group and between-group effects. If no covariates are included in the model and the between-group
effect of X is disabled, there will not be any between-group effects in each
of the mediators’ sections. If any moderators are included, the interaction
terms are labeled using int, and the Interaction Codes section contains
information on what each interaction term represents.

6.4

Random Effects

If the level-1 residual covariance matrix is specified as diagonal, the estimates are displayed in the Level-1 Residual Estimates section. If the matrix
is specified as unstructured, the effects are labeled with a number system
where the effect is a variance parameter if the two numbers in parentheses
are the same, and a covariance parameter if the two numbers differ. The
14

numbers correspond to the key provided below the table.
If the random effect covariance matrix is specified as diagonal (the default),
the Random Effects section of the output will contain the estimated variance of each random effect, as well as the relevant test statistics for that
effect. If the covariance matrix is specified as unstructured, the Random Effect Estimates table will contained each estimated variance and covariance
parameter, as well as the relevant test statistics for each of these parameters. These effects use the same number system as the Level-1 Residual
Estimates section. A table containing the number key for each effect is
also included. Finally, the estimated covariance and correlation matrices
are provided.

6.5

Index of Moderated Mediation

If any moderators are included in the model, an Index of Moderated Mediation section follows the Random Effects section. This section includes the
index of moderated mediation for each interaction term as well as a Monte
Carlo confidence interval. If the same variable is specified as a moderator
for both a and b, the linear and quadratic terms are included. Further, this
section is broken up by within-group and between-group effects.

6.6

Indirect Effect(s)

The final section included in the output contains the indirect effect(s). If
there are any moderators in the model, a code is provided which states what
value of the moderator(s) the indirect effect(s) are conditional on. These
are the values specified using modMcent and modYcent, which default
to 0. If no moderators are specified, the indirect effects are unconditional.
The first Within- Indirect Effect(s) section displays the estimated average
within-group indirect effect(s), as well as the estimated variability of indirect effects across level-2 units. If neither a nor b are random, the variance
of the indirect effect is 0. The next Within- Indirect Effect(s) section contains a normal-theory test on the average within-group indirect effect(s).
A Monte Carlo confidence interval is also provided. Finally, the BetweenIndirect Effect(s) section contains the normal-theory test and Monte Carlo
confidence interval for the between-group indirect effect(s). If xB = 0,
this section is omitted.
15

If multiple mediators are specified, a section containing indirect effect contrasts follows. Every pairwise combination of indirect effects is tested using
a Monte Carlo confidence interval. This section is broken up by withingroup and between-group effects.

References
Bauer, D. J., Preacher, K. J., & Gil, K. M. (2006). Conceptualizing and
testing random indirect effects and moderated mediation in multilevel models: new procedures and recommendations. Psychological
Methods, 11 (2), 142–163.
Hayes, A. F. (2013). Introduction to mediation, moderation, and conditional
process analysis: A regression-based approach. Guilford Press.
Hayes, A. F. (2015). An index and test of linear moderated mediation.
Multivariate Behavioral Research, 50 (1), 1–22.
Zhang, Z., Zyphur, M. J., & Preacher, K. J. (2009). Testing multilevel
mediation using hierarchical linear models problems and solutions.
Organizational Research Methods, 12 (4), 695–719.

16



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 16
Producer                        : pdfTeX-1.40.16
Creator                         : TeX
Create Date                     : 2017:05:24 11:40:57-04:00
Modify Date                     : 2017:05:24 11:40:57-04:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) kpathsea version 6.2.1
EXIF Metadata provided by EXIF.tools

Navigation menu