Message/Author 


Dear Mplus users, I have used MlwiN software to do multilevel analysis to diary data. In my analyses daylevel variables (time points) are nested within persons. All daylevel variables (measured over 5 days) predict daylevel variables, after controling for the traitlevel versions of outcomes. I did 4 analyses which imply mediation but now I want to combine them all in one model, so as to test a multilevel SEM for mediation: daylevel x1, x2 and x1*x2 (interaction) predicting daylevel x3, x4, x5 (controlling for traitlevel x3, x4, x5) and daylevel x3x5 predicting daylevel x6 (controlling for traitlevel x6). I am new in Mplus but I read that for this type of analysis, I should look at Growth Modeling and/or Survival Analysis. Here are my questions: 1. Is it chapter 6 of the Guide that is appropriate for my analysis? And if so, is it called survival analysis what I need to do? Which example should I study? 2. Does my data set need to have the multilevel structure (time points nested within persons)? Can I use the data file I have been using for MlwiN or are there any other preparations I need to do in the file before I start analyzing? Any help would be very much appreciated. Kind regards Paris Petrou 


Can you give a little more information about the model, such as what is meant by "daylevel" variables and "traitlevel" sources of the outcome? Is there a particularly pertinent reference that you can give or can you write out the statistical model? 


Bengt, thank you very much for your prompt reaction. Trait is a stable construct that is measured only once, before the start of the diary study and is representing the higher level, "person". Daylevel variables are all the variables which comprise the diary study/survey. They are measured 5 times. They form the first (lower) level and are nested within persons. Actually, I just found a published paper that performed a similar type of multilevel analysis which specified 2 levels and I am wondering if I can do the same. It is: Biennewies, Sonnentag & Mojza (2010). Journal of Occupational and Organizational Psychology, 83(2), 419441. I am still puzzled regarding my two questions above, though! Kind regards Paris 


It sounds like your daylevel variables for 5 time points should be arranged in a wide format as in Chapter 6 of the Mplus User's Guide. A twolevel model is not needed in Mplus when taking this wide approach. The traitlevel variables are simply added to the daylevel variables, measured only once. And it sounds like you have several (4) versions of these variables and that you want to combine them into one model which is fine  you still have a singlelevel, wide setup, but just having more variables. You are not interested in growth it seems, but you just want to do regressions with daylevel variables as DVs, which is straightforward in this setting. 


To add my 2 cents, as an experiencesampling researcher who uses Mplus, I'd encourage you to read Heck and Thomas's recent book on multilevel modeling. Their book has good coverage of how to specify ESMtype models using a general latent variable approach, including sample Mplus syntax. 


Bengt and Paul, thank you both for your comments. Bengt, what do you mean by wide format? Should repeated measures be nested within individuals? Indeed I am not interested in growth. Only in regressions between daylevel variables, but after controling for trait level. For every daylevel outcome I control for trait version of this variable. So, traitlevel variables will also be predictors in this SEM. 


When data are in wide format, each variable represents one column of the data set. When data are in long format, there is one variable representing the outcome with a second variable specifying the time of measurement or the cluster. 


Hi Linda et al., With ESM/diary data for 3 occasions in MLSEM there's a problem: This imposes compound symmetry across occasions of measurement. E.g., covariance at Times 13 along an Item 1 are only allowed to covary through betweenperson variance in Item 1. But, often both betweenperson and autoregressive (co)variance are expected. I'm trying to extract the observationspecific residuals to impose AR(1). However, individuallyvarying factor loadings or dummycoded predictor variables with random slopes seem needed. e.g., with Y1 measured at 3 occasions, 3 dummycoded variables T1T3 could code for occasion to separate residuals R1R3: %WITHIN% R1  Y1 on T1@1; R2  Y1 on T2@1; R3  Y1 on T3@1; R3 on R2 (a); R2 on R1 (a); R2 R3 (Var); [R1@0 R2@0 R3@0]; Y1@0; Mplus puts the random slopes at the between level (sensibly), but they should be at the within level. The dummy codings can be thought of as individuallyvarying factor loadings at the within level, but how to make that work? Of course R1R3 could be specified at the between level, but that adds parameters to the between model that don't belong there. Any ideas? 


Perhaps the following does what you want. Take a wide, singlelevel approach spreading out y by time. Let the person variance be handled by a factor influencing the item at the different time points with loadings fixed at 1. Add AR(1) correlated residuals using UG ex6.17. 

Mike Zyphur posted on Thursday, July 22, 2010  7:52 pm



Hi Bengt, thanks for responding. But you've ruined the fun! :) Your parameterization is surely the way to go. Unfortunately, I have roughly 30 measurement occasions for some study participants and there are around 10 observed variables. I'd like to avoid an observed COV matrix with 300 rows/columns, ergo MLSEM looked an easier route. If anything comes to mind in the future regarding this problemwhich seems substantial for MLSEM with longitudinal dataI'm all ears! Thank you for your time 


Initially I had planned on analyzing my diary data with multilevel SEM, but I'm trying to see how it will work out in wide format. However, I'm considered with the implications of this would be? With some variables measured on the between level (baseline measures) and others on the within level (daily measures), doesn't this approach lose something in terms of the within person variability by just using a singlelevel model? Any clarification on this would be great. Thanks, Aislin 


No, you can obtain the same results using the long and wide formats if the models are specified the same, for example, if in the wide format residual variances are held equal across time. The wide format simply reduces the number of levels by one. It takes a multivariate rather than a multilevel approach. 


Hi Linda and Bengt, I am doing a diary analysis that seems far too complex for wide format  we assess individuals (level 2) across a time period of 30 days (level 1). We measure affect and sexual behavior each day and have onetime individuallevel measurements as well. One of the goals of the analysis is to predict sexual behavior based on both daily affect (which I will eventually decompose into both within and betweenperson effects) as well as other individuallevel (level 2) variables. I am on board with how to specify all of this. My concern is that I would like to account for the autoregressive effect that repeated measurements create on the daylevel measurement of the outcome. So far, I've had some trouble figuring out how to do this, as it's typically handled using wide format. It's also worth noting that we are explicitly not interested in growth  we actually hope that behavior remains constant over time (though it probably changes slightly)  many times, the outcome will also be either dichotomous or nominal (using either binary or multinomial logistic models). I know exactly how to specify these autoregressive structures in other software (SPSS, HLM), but have still been unable to figure out how to do these models in Mplus using twolevel analysis, which is most desirable as we hope to conduct MLSEM as the end product. Thanks! 


You may want to email Ellen Hamaker at Utrecht Univ about her work on autoregressive modeling using Mplus. Tihomir Asparouhov of Mplus has also worked on related matters; see http://mplus.fss.uu.nl/2012/09/12/thefourthmplususersmeeting2/ Related to this is Individual Differences Factor Analysis as described in Asparouhov & Muthen (2012). General random effect latent variable modeling: Random subjects, items, contexts, and parameters. which is on our home page. 


Dear Mplus users, I really need your help. I am working on the mediation analysis of daily diary data. All of my variables are on the daily level: 2 predictors, 1 mediator and 2 outcomes measured for 5 consecutive days. I already did multilevel mediation, but for the two outcomes separately, and I want to combine them all in one model: Predictor1 > Mediator > Outcome1 Predictor1 > Mediator > Outcome2 Predictor2 > Mediator > Outcome1 Predictor2 > Mediator > Outcome2 I would really appreciate if you could guide me in: 1. Which type of analysis is most appropriate (multilevel SEM? LGCM?)? 2. How to deal with two outcomes in the same mediation model for daily diary data? Thank you very much in advance! Best, Maja 


You may want to ask this general modeling question on SEMNET. 

Y.A. posted on Thursday, August 27, 2020  7:24 pm



Dear prof. Muthen, I would like to use my daily diary data to test a mediation model, in that the IV and the MED were measured on day T and the DV was measured on day T+1. I realized that I should use the wide form dataset, but I could not figure out how to specify the model in mplus. Could you point me a technical guide or reference about the mplus syntax on this model? Thank you very much. 


If you have 2 time points, you can write in singlelevel, wide format: Med1 ON IV1; DV2 ON Med1 IV1; 

Y.A. posted on Saturday, August 29, 2020  7:25 pm



Dear Prof. Muthen, So I have 10 time points... If I do MED1 ON IV1; DV2 ON MED1 IV1; MED2 ON IV2; DV3 ON MED2 IV2; MED3 ON IV3; DV4 ON MED3 IV3; ...... MED9 ON IV9; DV10 ON MED9 IV9; then how do I handle these nine varying mediation effects? Thank you very much. 


That's a bigger question. Have a look at articles by Maxwell & Cole for instance. They wrote about this in 2007 in Psych Methods and in 2011 in MBR. There are more recent articles on this as well but I don't have them at hand right now. 

isabella posted on Sunday, October 18, 2020  12:37 pm



Hello All, we have ESM data. All variables are at L1. IV, moderator, mediator are measured at T1 midday and the two DVs at T2 evening. How do I model and interpret the interaction? Any guidance is greatly appreciated. Below is the code I have so far. USEVARIABLES ARE IV1 T1Med T1Moderator T1Cont1 T1TCont2 T2DV1 T2DV2 T2Cont Inter1 ; between= ; within= IV1 T1Cont1 T1TCont2 T1Moderator Inter1 ; cluster=UID; DEFINE: Center (GRANDMEAN); Center IV1 T1Cont1 T1TCont2 T1Moderator (GROUPMEAN); Inter1 = IV1 *T1Moderator ; ANALYSIS: TYPE=TWOLEVEL RANDOM; ESTIMATOR = MLR; MODEL: %within% S1 T1Med on IV1; T1Med on T1Cont1 T1TCont2 ; S2T1Med on T1Moderator; T1Med on T1Cont1 T1TCont2 ; S3T1Med on Inter1; T1Moderator on T1Cont1 T1TCont2; S4T2DV1 on T1Med; T2DV1 on IV1 T1Cont1 T1TCont2 T2Cont ; S5T2DV2 on T1Med; T2DV2 on IV1 T1Cont1 T1TCont2 T2Cont ; 


So you have Level 1 = time and Level 2 = person? But it sounds like you have only 2 time points which isn't typical ESM. 

isabella posted on Monday, October 19, 2020  6:59 pm



Thank you for quick response! We have collected ESM data for 10 consecutive days two times per day (midday and afterwork)  daily variables are nested within persons (approx 700 data points). All variables in the model are at L1 (within person level). The L1 predictors and moderators are measured with the afternoon survey and the L1 DVs are measured with the afterwork survey. I am not sure how to model the L1 interaction term (level 1 IV & level 1 moderator). 


You say: The L1 predictors and moderators are measured with the afternoon survey and the L1 DVs are measured with the afterwork survey. When you said "afternoon survey", did you mean midday survey? 

isabella posted on Wednesday, October 21, 2020  1:19 pm



Yes, that would be correct  with afternoon survey I wanted to mean midday survey. Thank you for the question 


You can use Define to do groupmean centering of your L1 predictor and moderator and create their interaction. 

isabella posted on Wednesday, October 21, 2020  5:20 pm



Thank you Dr. Muthen for your quick replies. I am thinking I am doing the interaction as recommended. Below is my code (without controls). Would this be a correct understanding? Many thanks again for your time and advice. DEFINE: Center (GRANDMEAN); Center IV1 T1Moderator (GROUPMEAN); Inter1 = IV1 *T1Moderator ; ANALYSIS: TYPE=TWOLEVEL RANDOM; ESTIMATOR = MLR; MODEL: %within% S1 T1Med on IV1; S2T1Med on T1Moderator; S3T1Med on Inter1; S4T2DV1 on T1Med; S5T2DV2 on T1Med; 


Looks right. You might want to use the Bayes estimator. 

isabella posted on Saturday, October 24, 2020  6:24 am



Thank you for looking into this syntax much appreciated. Two quick followup questions: 1) I am looking at S3 significance to test the moderation? 2) Could you please point me to any resource to see how I can start using the Bayes estimator please? Many thanks 


Right. But you may want to use fixed slopes as a first step because your analysis involves only 10 time points which makes it harder to estimate random slopes. Bayes intros are given in our Short Course Topic 11, in my 2010 Bayes intro paper (see Papers, Bayesian Analysis), and also in Chapter 9 of our RMA book (see web site for all this). 

isabella posted on Saturday, October 24, 2020  9:07 am



Thank you very much! I will look into these to use Bayesian estimator. 

Back to top 