Longitudinal data FAQs

Does MLwiN need repeated measures data to be in long or in wide format?

Example question: I'm trying to set up a model using repeated measures data (with occasion within student within school). Looking at the example data, I see that level 1 ID has to be unique. Does this mean that the repeated measures have to be stored in the "wide" format?

No, MLwiN actually requires repeated measures data to be in the long, not the wide, format when it comes to analysis. The User's Guide (chapter 13, section 13.2) shows how to convert data from wide to long format. However this does not mean that the level 1 IDs are no longer unique. In repeated measures analysis, occasion (time) is regarded as level 1, student (in your case) becomes level 2, and so on. Nor does it matter that the natural level 1 ID, Occasion Number, will have the same value for more than one row in the dataset since we do not have to use this as our level 1 ID but can create a new ID variable. A unique level 1 ID, which will give a different number to each occasion-person combination, can be created by selecting Generate vector from the Data manipulation menu, and selecting Sequence under Type of vector, choosing a free Output column, typing 1 next to Start number, the length of your long dataset next to End number, and 1 next to Step value, and then selecting Generate. This can then be used as level 1 in the model, and a separate variable such as Time, Year or Occasion Number can be used as an explanatory variable.

Is it possible to define an AR process for the random effects at level 1?

Example question: Is it possible to define an AR process (autocorrelation structure) for the level 1 random effects when we have repeated measures data?

Yes. For details of how to do this (with an example), see Section 5 on p72 of the MLwiN version 2.10 manual supplement. Note that although this is description appears in the MLwiN version 2.10 manual supplement, in fact the process is exactly the same if working in MLwiN version 2.02.

When should I allow level 1 errors to be autocorrelated?

Generally, you would allow level 1 error terms to be correlated when the observations are close together in time so that you would expect that an observation will be similar to the previous observation (the phenomenon known as 'autocorrelation'). When the observations are further apart in time so that you expect that, after you have taken the mean response for the individual into account, there is no relationship between an observation and the one before it, the observations are not autocorrelated and you do not need to allow the level 1 error terms to be correlated. What counts as 'close together in time' and what counts as 'further apart in time' depends on exactly what you are measuring. Sometimes it is hard to decide before modelling whether the level 1 error terms should be correlated or not. In that case it is a good idea to fit a model which allows the level 1 error terms to be correlated and compare that model with one which does not allow the level 1 error terms to be correlated to see whether the level 1 error terms do need to be allowed to be correlated.

(Back to top)

Where are the time series macros?

Example question: I have a repeated measures dataset and would like to allow the level 1 error terms to be autocorrelated. I heard there were some macros which would do this, but cannot find them anywhere on your site.

The macros were removed when version 2.02 was released since they were found to be unstable. We now recommend an alternative method for setting up and running these models. This method is described in detail in Section 5 of the MLwiN 2.10 Beta Manual Supplement which is available from here. (Note that although this appears in the MLwiN 2.10 Beta Manual Supplement, exactly the same method can be used with MLwiN version 2.02). However, this method will only work with a Normal response model. Unfortunately we no longer provide the facility to estimate a binary response model with autocorrelated errors in MLwiN.

(Back to top)

Edit this page