Lagged Independent Variables?

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
yurisantino
Posts: 3
Joined: Mon Nov 13, 2017 10:19 am

Lagged Independent Variables?

Post by yurisantino »

Greetings! I have a brief question on how to enter lagged variables.

I have a small two-level model where participants (=level2) responded on 3 to 5 measurement occasions (=level1). I'm trying to model:

dependent variable = constant + daily "x" + lagged dependent variable (from the day before).

So I'm trying to see whether the relationship between x and y holds after I control for the measure of Y the day before.

Is there anyone that can help me and provide guidance? :mrgreen:

Thank you!

EDIT: I think lagged is the wrong word for it! sorry!

ChrisCharlton
Posts: 1193
Joined: Mon Oct 19, 2009 10:34 am

Re: Lagged Independent Variables?

Post by ChrisCharlton »

As with other software you would just need to create a second, lagged version, of the variable of interest and enter this into the model. MLwiN provides a command (MLLAG - also available via Data Manipulation->Multilevel Data Manipulations) to help with the creation of this within each cluster, although you will still need to ensure that variable is sorted, all time occasions are present, etc.

yurisantino
Posts: 3
Joined: Mon Nov 13, 2017 10:19 am

Re: Lagged Independent Variables?

Post by yurisantino »

Thank you kindly Chris for your response!

What exactly do you mean with sorted? I sometimes have only 3 measurement occasions for a person and sometimes 5, is that problematic?

So if I understand correctly, I have to do the following:

Multilevel Data Manipulations
-> operation: lags
-> on blocks defined by: person identifier
-> add to action lost
-> execute

Or am I missing something here, because I did not sort the variables? I assumed they were because the day variable is coded as 1, 2, 3, 4, 5 for al participants.

Thanks again Chris!

ChrisCharlton
Posts: 1193
Joined: Mon Oct 19, 2009 10:34 am

Re: Lagged Independent Variables?

Post by ChrisCharlton »

Yes, that looks like the correct use of the dialogue box.

The thing that you need to watch out for is that the command is just using the value from the previous row within the cluster, so if the rows were in the order occasions 3, 2, 1, 4, 5 for example then it would not pick up the correct values to lag as it would be assuming 1, 2, 3, 4, 5. Because of this you would need to ensure that the data was sorted by occasions within person.

If you were missing a measurement, e.g. 1,2,4,5 then the third lagged value would be based on occasion 2 instead of 3 (which doesn't exist and should perhaps be missing). In that case you might consider expanding the data so that there were rows for each possible occasion with person. If you had 1, 2, 3 and were missing 4, 5 then the problem shouldn't occur.

I would suggest examining the new lagged variable after it is created to ensure that it matches your expectations.

yurisantino
Posts: 3
Joined: Mon Nov 13, 2017 10:19 am

Re: Lagged Independent Variables?

Post by yurisantino »

Thank you very much for your help Chris! I think I understand now :-)

Best wishes,

Yuri

Post Reply