

Random effect without a lagged variable 

Message/Author 


Hi, I have a problem with my syntax and I hope you can help me. I have a model where I want to check the mediation from alliance (Inter) to symptoms (HSCL) over Coping (Intra) and the other way round over two sessions(L1 means that this is a manually lagged variable). Additionally I want to check on autoregressive effects (I left that out in the syntax below). The problem is in the mediations. MPlus has a problem to run over the random effects "pM11 pM12 pM21 pM22". There occur two problems: First there is an error if there is no Mpluslagged variable on the right side of the ON statement (if the variable is lagged by MPlus it is no problem). Second MPlus does not recognize the labeling "b" and "d" if I put those relations on random. I hope you can help with my problems. Thanks in advance. Btw on the between level all variables and random effects are correlated. !Mediation 1 (Coping Mediator) pM11  HSCL ON Intra_L1 (a); pM12  Intra_L1 ON Inter_L1&1 (b); pM13  HSCL ON Inter_L1&1; !Mediation 2 (Alliance Mediator) pM21  HSCL ON Inter_L1 (c); pM22  Inter_L1 ON Intra_L1&1 (d); pM23  HSCL ON Intra_L1&1; !Rest Inter_L1 WITH Intra_L1; p23  Intra_L1 ON HSCL&1; p13  Inter_L1 ON HSCL&1; 


You should not put a label like pM11  HSCL ON Intra_L1 (a); because this expression does not refer to one parameter. The parameters related to this random slope appear on the Between level and there can be several of these parameters (mean, variance, regression slope). You mention lagged variables  how many time points do you have? You cannot have two different, contradictory models in the same Model command. E.g. "intra" cannot be both a mediator and an IV. 


Hi Bengt, Thanks for your quick response. If I leave out pM11, pM12, pM21 and pM22, the model runs perfectly fine. If I put pM11 or pM21 into the model, I get this Error report: *** ERROR in MODEL command Models with random slopes for dependent variables with missing values cannot be estimated with the BAYES estimator unless the variable is defined as WITHIN. One or more observations has missing values for a dependent variable on the righthand side of an ON statement in a random slope definition. Is there any possibility to put these relations on random? And what is the reason that this does not work? I quite do not understand this yet. If I put pM12 or pM22 into the model, I get this report: *** ERROR Unknown parameter label in MODEL CONSTRAINT: B I wonder why this works when I fix the parameter instead of putting them on random. What do I have to do to change that? I have three time points in total in the model, albeit there are only two time points in MPlus because one variable is manually lagged in SPSS before the MPlus analysis. The reason was that I had problems when I put a lagged variable before an ON statement. Therefore, each variable in this MPlusmodel has only one lag. There are 1645 subjects with 4 to 113 observations. I really appreciate your help. Best, Julian 


Please send the 2 outputs to Support along with your license number. 

AH posted on Thursday, April 02, 2020  5:07 am



Dear Bengt, a consecutive question. When I define a model %WITHIN% phi  x ON x&1; beta  x ON y; x; %BETWEEN% phi; beta; x; y; [x]; [phi]; [beta]; [y]; I get the following error message: *** ERROR in MODEL command: Models with random slopes for dependent variables with missing values cannot be estimated with the BAYES estimator unless the variable is defined as WITHIN. One or more observations has missing values for a dependent variable on the righthand side of an ON statement in a random slope definition. The error message occurred after I added beta  x ON y. What can I do to solve this problem? Thank you very much. Best, Andrea 


You have to update your copy of Mplus. There is no such message in the current 8.4 version. 

Back to top 

