Message/Author 


Hi, I want to test a mediation model, where IV and mediator are continuous and DV is a count variable. It was no problem to specify the model itself but unfortunately MPlus (6.1) cannot determine indirect effects when using count data (error: "BOOTSTRAP is not allowed with ALGORITHM=INTEGRATION."). Is there any workaround (f.e. with MODEL CONSTRAINT command), so I can test the assumed mediation effect formally? Thanks in advance, Sebastian 


In this situation you can use MODEL CONSTRAINT to define the indirect effect. 


Thank you for the quick response. I'm not sure if I did it correct, but I finally specified a constraint model with 4IV, 1 Med and 1 CountDV (see below). Is this the way you thought of? If possible, I additionally want to determine the overall mediation effect (med_total). According to Preacher & Hays (2008) the total indirect effect is the sum of the specific indirect effects. Unfortunately, they used the bootstrapprocedure to analyze indirect effects and they had several mediators, not several IVs. Do you think I can still apply this rule to the current model (like I have done)? Thank you very much, Sebastian Title: Mediation with model constraints 4 IV, 1 Med, 1 DV (count) Data: File is MPLUS3.dat ; Variable: Names are age sex type y2 y1 y3 x4 x1 x2 x3 m2 m1 sq2 sq3 sq1; usevariables are y1 m1 x1 x2 x3 x4; count is y1; analysis: estimator=ml; model: m1 on x1 (a1); m1 on x2 (a2); m1 on x3 (a3); m1 on x4 (a4); y1 on m1 (b); y1 on x1 x2 x3 x4; Model Constraint: new (med1 med2 med3 med4 med_total); med1 = a1*b; med2 = a2*b; med3 = a3*b; med4 = a4*b; med_total = med1+med2+med3+med4; output: samp; stdyx; tech1; 


This looks correct. 


Great. Thank you! 


Respected Prof. Muthen. In the model I am testing, I have a count mediator and continuous DV. The count variable's distribution is zero inflated negative binomial. Model specification is done for the zero inflation parameter as well and the model runs fine. However, my challenge is 1.)How to test for indirect effect? I read in one of your papers, it is incorrect to test just product (i.e. a * b) for noncontinuous mediators. Could you please advice a sample Mplus code to properly do this please? 2.)How to bootstrap the indirect effects captured in step 1. I am unable to do with ESTI=MLR. 3.)How to test indirect effect for model in step 1 using ESTI=Bayes. 4.)As additional analysis I introduce a continuous moderator to model in step 1. Is it possible to test this model after properly undertaking the mediation with count variable? As always, my sincere gratitude in advance!! 


A count mediator is a tricky situation. In the M on X regression you want to specify M as a count variable to get Poisson regression. But in the Y on M regression there isn't a way to treat M as count. There is not a continuous latent response variable formulation for count. So when you regress Y on M you have to treat M as continuous. I discuss it in the paper on our website Muthén, B. (2011). Applications of causally defined direct and indirect effects in mediation analysis using SEM in Mplus. 


Thanks a lot, Prof. I checked this paper and the new paper forthcoming in structural equation modeling. I don't see specific code for count mediator. Could you please share that code. Also in my model I specify count as negative binomial (with zero inflation) rather than Poisson because the mean and variance are unequal. So is that possible as well or I should force fir a Poisson? To above points, is it possible to test moderated mediation using the steps by Preacher et al for these types of count mediators? If so what would be the right formula to specify in the MODEL CONSTRAINT statement? 


The technical appendix, Secton 13.5 says: "The count variable can also be a mediator in which case the integral is replaced by a sum over the possible counts and using the probabilities determined by the Poisson distribution. Using m to predict y, m may be treated as continuous." Although possible, I have not tried this out in Mplus and therefore don't have code for it. It is advanced stuff, so unless you are a statistical expert I would not recommend that you get into this. Instead you would have to make approximations such as treating the mediator as a continuous variable. 


Dear Prof. Muthen. Thanks a lot for your advice. My sincere gratitude to you. 


Prof. Muthen. Sorry I forgot to request before. Could you please suggest a reference or citation for considering count as continuous in these kind of situation please. It is becoming extremely challenging for me to convince reviewers. 


I don't know of any references. If the tail is long enough, you could consider a censored variable. You need to look at the variable's distribution and be guided by that. This is a research topic. 


Thank you Prof. Muthen. 

Yan Liu posted on Thursday, May 15, 2014  11:03 am



Dear Dr. Muthen, I want to use the multilevel mediational models based on SEM proposed by Preacher, Zyphur and Zhang (2010). I have one predictor, one covariate, one mediator and one outcome, which were measured at individual level. In addition, I have another predictor, intervention (control vs. experiment), which was conducted at school level. When I treat the outcome as a continuous variable, the model works. However the model doesn't run when I define the outcome as a count variable using negative binomial (nb). I wonder if negative binomial works for Preacher's multilevel mediational model. Many thanks! 


You should have no problem estimating 2level model with a DV that is nb. Whether or not mediation effects can be logically defined is another matter. If you have problems with the run, send output and license number to Support. 

Yan Liu posted on Thursday, May 15, 2014  8:34 pm



Thanks for your reply! Before I send you the output, I would like you to take a quick look and see if there are something wrong with my Mplus code. The error message shows that the X (predictor), Cov (covariate), and M (mediator) cannot be used at between level. They have to be defined at within level. In addition, when I treat Y as continuous variable, the saddle point appears, so I decreased the criterion for MCONVERGENCE and increased the random starts. USEVARIABLES ARE COV X M Y tchid; COUNT=Y (nb); MISSING=ALL(999); CLUSTER = tchid; ANALYSIS: TYPE = TWOLEVEL; STARTS=500; STITERATIONS=1000; INTEGRATION =GAUSSHERMITE; MCONVERGENCE=0.08; MODEL: %WITHIN% M ON COV X (aw); Y ON COV X M (bw); %BETWEEN% M ON COV X (ab); Y ON COV X M (bb); MODEL CONSTRAINT: NEW(indw indb); indw=aw*bw; indb=ab*bb; 


Please send your output and license number to support@statmodel.com. 

Back to top 