Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Moderated mediation with multilevel data

From   Stas Kolenikov <>
Subject   Re: st: Moderated mediation with multilevel data
Date   Mon, 27 Feb 2012 20:51:14 -0600

On Mon, Feb 27, 2012 at 3:18 PM, Kris Anderson <> wrote:
> Hi, all.
> I have been using two Stata FAQs ("How can I do moderated mediation in
> Stata? and "How can I perform mediation with multilevel data?").
> I am getting stuck on one aspect of the FAQ for moderated mediation.  In
> Model 3, it probes mediation at levels of the moderator but the interaction
> is nonsignificant in the sample output they provide. Can anyone explain
> that? (I contacted the authors directly without a reply). In my own data,
> the interaction of mw is nonsignificant, but when I run the nlcom and
> bootstrap the results, each level is significant.

Interaction says that different levels significantly differ from one
another. The interaction in the UCLA FAQ
( is barely
significant, and you see that the confidence intervals at different
levels overlap notably. I would also add to the discussion there that
the procedure does not account properly for variability in the mean
and s.d. of the moderator variable. A proper "argument" of the
bootstrap should be

program bootm3, rclass
  sum w
  local wmean = r(mean)
  local wsd = r(sd)

  sureg (m x) (y m x w mw)
  return scalar cielw = [m]_b[x]*([y]_b[m]+(`wmean'-`wsd')*[y]_b[mw])
  return scalar ciemn = [m]_b[x]*([y]_b[m]+(`wmean')*[y]_b[mw])
  return scalar ciehi = [m]_b[x]*([y]_b[m]+(`wmean'+`wsd')*[y]_b[mw])

Why Preacher & co did not think about it, I don't know. But that's
certainly an omission, and incorporating it properly will further
extend and skew your bootstrap CIs.

[grumble mode on] you should've specified that you meant UCLA website,
by the way, as each of the statalist members may have their own little
FAQ on their personal webpage, and would have grounds to respond to
you by saying, "The Stata FAQ that I am familiar with does not have
this question. Where on earth did you get it from?"

> The second issue is that my data is multilevel. Does anyone know of a way to
> run moderated mediation in Stata with multilevel data? When I ignore the
> levels, I find mediation but I want to confirm it as the levels matter.

So which variables are measured at which levels? Nothing in the setup
of the UCLA FAQ says that any of the variables must have distinct
values for all observations in the data set; if say your moderator is
constant within schools (or hospitals, or whatever have you), I don't
see anything that needs to be drastically changed or dismissed or
modified. So unless you specifically want to model interactions
between levels, or include a bunch of random effects as is done in the
multilevel mediation UCLA FAQ (the one with weird -reshape-d
-xtmixed-), you can just run this stuff as is. The -bootstrap-,
however, would need to be performed in clusters; read about its
-cluster()- and -clusterid()- options. With some puffing, you can
rewrite the necessary -program-s that envelope the -xtmixed- rather
than -sureg-, too.

Stas Kolenikov, also found at
Small print: I use this email account for mailing lists only.

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index