In this practical you will practice with fitting multiple (Bayesian) single subject models for intensive longitudinal data, specifically AR(1) and AR(2) models, an AR(1) model with a covariate, a VAR(1) model and two models that account for measurement error. You will fit the models for the data of two participants to get an impression of individual differences in dynamics.

Mplus v8

For the DSEM analyses in Mplus you will need Mplus version 8 or higher. You need a license for this, although most of these n=1 models you may be able to fit with the free student version of Mplus.

www.statmodel.com

The data

We will work with the data of two female participants Jane and Mary (Names ficional, data courtesy of Schuurman, Houtveen and Hamaker, 2015). The data consist of daily diary measurements, for 91 days for Jane and 105 days for Mary. The original data contains various measures on mood, positive and negative affect and symptoms surrounding the women’s periods.

Basic AR models

Fitting an AR(1) model.

1. Take a look at the data.

We will start by looking at both women’s rating (scale 1-100 low-high) of their daily overall mood. In the files AR1_Mary.dat and AR1_Jane.dat you will find the data for each woman.

In the file AR1.inp you will find the modelcode for a basic AR1 model in Mplus. If run this model in Mplus you will fit it on the simulated data set included in AR1.dat. Try it out, and take a look at the model specification, output, and the plots you can check under the view plots menu item in Mplus.

2. Adjust the model code.

Now, adjust the model code to fit the models for Jane’s data, and after that for Mary’s data.

3. Fit the model.

Run the model for Jane and Mary, and take a look at the time series plots for the mood of the participants, as wel as inspect plots of the autocorrelations and partial autocorrelations for the data of each woman. (Click on the output file that has appeared, and in the Mplus menu’s go to view plots.)

4. Look at plots for the data.

Based on the autocorrelations and partial autocorrelations for the different lags of the women’s data, what order of autoregressive model would you fit for each of them based on these plots (how many lags would you like to include)?

5. Check convergence.

After the model has been fitted, do some convergence checks. Specifically, we check the density plots, trace plots, and the gelman-rubin statistics (potential scale reduction factors). You can take a look at the density and trace plots in Mplus via view plots (because we requestions type=PLOT3 in the output). The Gelman-Rubin statistics (PSRs) are reported at the end of the Mplus output file (because we requested tech8 in the output). The density plots should look nice and smooth, the trace plots should look like fat catterpillars, and gelman-rubin statistics should be very very near 1.

6. Interpret the results.

Now, look at the estimated coefficients for each woman and interpret the results. Compare the results for Jane and for Mary.

7. Rerun the model to further evaluate convergence.

Rerun the model with a larger number of burnin and iterations. Do the results change (if the model has converged, the changes should be very small).

AR2 Analysis

1.Adjust model code and fit the model.

Next, fit an AR2 model in Mplus for Jane and Mary by adjusting the model code AR2.inp.

2. Check convergence and interpret the results.

Has the model converged? If so, interpret the results.

3. Compare results for Jane and Mary.

Does an AR(1) model seem to suit Jane best, or an AR(2) model, based on these and the former AR1 results? What about for Mary?

AR1 model with a covariate

1. Take a look at the data.

Next, lets add an exogenous covariate to the AR(1) model. We have information on when each women had her period - we will use this to predict each woman’s mood. For this we will load an external data file with the same mood data, and data on each women’s period (0 of not on period, 1 if on period). For the latter variable, for this example we have filled in scores where there were missing observations (because exogenous variables are not allowed to have missing observations in the analysis). An alternative way to deal with this is to make the covariate an endogenous variable (or impute for these observations in another way), but this is beyond the scope of this workshop.

Take a look the data for Mary and Jane in AR1pred_Jane.dat and AR1pred_Mary.dat.

2. Take a look at the model code and adjust it.

Take a look at the Mplus model code for the AR(1) model with an exogenous predictor in the file AR1pred.inp. How are exogenous variables included in the model? What does each regression effect mean? Further, note that we are estimating an intercept rather than a mean for mood. Adjust the model code so you can fit the model for Jane and Mary.

3. Fit the model and evaluate the results.

Fit the model to the data for Jane and Mary, check the convergence, and interpret and compare the results.

Basic Bivariate VAR(1) Model

Next we will fit a multivariate, Vector Autoregressive model (of order 1); a VAR(1) model. We will fit the model for two variables, overall mood like before, and nervous tension.

1. Take a look at the model code and adjust it. Fit the model.

Take a look at the model code VAR1.inp and adjust the code to work with the data for Jane and Mary (VAR1_Jane.dat, VAR1_Jane.dat). Fit the model.

2. Evaluate the time series plots for the data.

Start by taking a look at the time series data plots for both women. Do the variables seem to sync up over time? What kind of effects would you expect nervous tension and mood to have on each other over time? What about concurrently?

3 Check convergence and interpret the results.

Evaluate the convergence of the model. Draw a path model based on the results for Jane and for Mary, leaving out paths for which the sign of the effect is unclear based on the 95% credible intervals (‘nonsignificant’ effects). Interpret and compare the results for Jane and Mary.

Latent AR(1) model or Dynamic Factor Model

Finally, we will model a latent variable, Postive Affect, with an AR(1) process. Both Jane and Mary provided daily evaluations of 8 positive affect items, namely “attentive”, “strong”, “interested”, “enthausiastic”, “proud”, “determined”, “inspired”, and “exstatic”. We will model a common positive affect factor for these items, and see if there is an autoregressive effect for latent Positive Affect.

1. Take a look at the model code and data. Adjust code and fit the model.

Take a look at the model code DFAR1.inp and adjust the code to work with the data for Jane and Mary (DFAR1_Jane.dat, DFAR1_Jane.dat). Fit the model.

2. Evaluate the time series plots for the data.

Start by taking a look at the time series data plots for both women. Do the variables seem to share variance at concurrent time points? Do they sync up?

3 Check convergence and interpret the results.

Evaluate the convergence of the models. Compare the models for Mary and Jane. Would you say based on these results that Positive Affect is measurement invariant for Jane and Mary (that the latent variable represent the same thing for Jane and Mary)? If not, how do they differ?

End of n=1 practical.

This is the end of the n=1 exercises. I hope you’ve been able to get an impression of n=1 modeling of intensive longitudinal data, and the individual differences in dynamic processes. In the multilevel extensions of these models, these individual differences are explicitly modeled. You can practice with such a model in the multilevel practical.