Time-series predicting level 2? outcome PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
 Kieran Ayling posted on Monday, July 24, 2017 - 1:05 am
Hi - I am exploring the new Mplus capabilities for time series data following version 8 - but I am struggling slightly to understand how I specify some models.

So to help me understand, I have the following typical example of something I am trying to do - and was hoping someone could advise me how to specify it in mplus 8.

I have a data set where I have measured positive affect and negative affect in individuals daily over 18 days (PA1-PA18 and NA1-NA18). I expect these to have some autocorrelation and for these factors to be associated with each other. I am particularly interested in whether positive and negative affect over the measured period predicts two outcomes measured at a single time point after the completion of the positive and negative affect measures. One outcome is continuous (vac_con), and one is binary (vac_bin). They do not necessarily need to be modelled together - but I presume specifying may be different between binary and continuous outcomes.

Is a two-level approach now suitable for this kind of data, with the repeated measures at level one and outcome at level 2, and if so how would one specify the above?

Thanks in advance!
 Bengt O. Muthen posted on Monday, July 24, 2017 - 4:26 pm
See UG ex 9.30 where your 2 outcomes vac_con and vac_bin play the role of z.

The data should be in long format

person 1, day1
person 1, day2
person 1, day18
person 2, day1

Note also our workshop on this topic (DSEM) in August at Johns Hopkins (waitlist is available).
 Kieran Ayling posted on Monday, July 31, 2017 - 2:19 am
Thanks Bengt, so there is no difference in specifying binary categorical and continuous outcomes?

So to extend my understanding a little further then, I have run the following model, with another binary outcome (Pregnant - 0=No, 1=Yes):

s | PA ON PA&1;
logv | PA;
Pregnant ON PA s logv Yrs_Inf AGE Attempts;
PA S Logv ON Yrs_Inf AGE Attempts;
PA S Logv WITH PA S Logv;

In interpreting the output, am I right in my understanding that "s" is the autocorrelation of PA?

I am less sure about what logv means in lay terms - for example how am I to interpret a significant result for Pregnant ON logv?

I would love to come to the DSEM workshop, unfortunately I am UK based so attendance is not likely to be practical.
 Bengt O. Muthen posted on Monday, July 31, 2017 - 5:54 pm
No, the categorical outcome must be put on the Categorical list.

Yes, is is the random autcorrelation varying across subjects.

Logv refers to the residual variance on Within. As variability increases the probability of Pregnant increases/decreases.

You missed a workshop in the Netherlands in July. See the DSEM handouts for that which are on our home page. And, our Hopkins workshop - which is longer - will be videotaped and posted on our website.
 Peter Hilpert posted on Friday, December 27, 2019 - 12:37 pm
Hello, I have a DSEM model and a few questions. We have assessed partners' during couple interactions (second by second: labelled emo_m and emo_f) and I want to see if the influence of women's emotions on men's subsequent emotions predict breakup after two years (dichotomous).

e_mm | emo_m ON emo_m&1;
e_mf | emo_m ON emo_f&1;
e_fm | emo_f ON emo_m&1;
e_ff | emo_f ON emo_f&1;


y2 ON e_mf e_fm e_mm e_ff;

e_mm WITH e_mf e_fm e_ff emo_m emo_f;
e_mf WITH e_fm e_ff emo_m emo_f;
e_fm WITH e_ff emo_m emo_f;
e_ff WITH emo_m emo_f;
emo_m WITH emo_f;

1. How to I specify that the y2 variable is binary?
2. Does y2 has to correlate with other factors on the between level (y2 WITH emo_m emo_f)?
3. How can I test if not only the state emotion but the trait emotion during the interaction influence y2? How can I specify the trait?
4. How can I save the random effects so that I can plot the effect of e_fm on y2?
5. Will it be possible to run a multi-group and/or mixture modeling approach as well soon?
Thanks a lot! The DSEM approach is very cool!)
 Tihomir Asparouhov posted on Friday, December 27, 2019 - 2:42 pm
1. Use "categorical = y2;" in the variable command. This will yield a probit regression for y2

2. You have two good options

a. y2 ON e_mf e_fm e_mm e_ff emo_m emo_f;
b. y2 emo_m emo_f ON e_mf e_fm e_mm e_ff;
y2 emo_m emo_f with y2 emo_m emo_f;
and take out the correlations between the random ar coefficients and the random intercepts. Bayes runs well when you have complete variance covariance blocks see Section 2.1
Just adding y2 with emo_m won't quite work with the default fast settings so you will need to use other estimation settings.

Substantively we always expect stronger effects from random intercepts than from random slopes. If a person is consistently emotionally distressed (random intercepts emo_f emo_m) in the marriage one would expect that fact to be a good predictor of marriage success.

3. I am not 100% sure I understand the question - if you can order the different traits you can use categorical variables for emo_m and emo_f and have 1 not distresed, 2 -mildly distressed, 3-very distressed. Alternatively you can use multiple binary variables for each of the different traits

4. use
savedata: file=1.dat; save=FS(100);
plot:type=plot3; factors=e_fm;
You can get the plot under plots/scatter plots

5. At this time you can run multiple group models if you setup the model as parallels
y1g1 y2g1 y1g2 y2g2
So a model with two variables two groups can be written as a model with 4 variables. You will have to fill in missing values for the shorter group. Mixture models can be done by saving plausible values from the DSEM model and then subsequently you can run the mixture model with type=imputation. See
So a two-stage estimation.
 song hye sun posted on Friday, October 30, 2020 - 1:04 pm
Dear Muthen

I have a DSEM model and a few questions
As far as I know, logv in DSEM refers to the residual variance on within.

1) can the LOGV of BETWEEN LEVEL MEANS in MODEL RESULTS be negative?
2) How am I to interpret this?
3) which one should I interpret, "MODEL RESULTS" or "STANDARDIZED MODEL RESULTS (STDYX Standardization)"?

Thanks in advance!
 Bengt O. Muthen posted on Saturday, October 31, 2020 - 2:00 pm
1-2 Yes, a negative logv means a v that is smaller than 1.

3) That's up to you depending on what you want to show.
Back to top
Add Your Message Here
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Options: Enable HTML code in message
Automatically activate URLs in message