Hello,

I am attempting to use xtmixed for a repeated measures analysis looking at the effect of an intervention on scores for many different hospitals. I also want to adjust for rural/urban status. Each hospital has two years of data (labeled score1 and score2). I believed that xtmixed would be appropriate for this type of analysis, where hospital would be the random effect and the intervention and rural/urban status would be fixed effects. I'm getting confused on what to do with the time variable (a binary variable where 0=baseline and 1=2 years after baseline).

This is what I've done so far:

I reshaped like this: reshape long score, i(hospital) j(time).

I did a lot of reading and looking at examples but am still confused about how the time variable should be included in the model and what the conditions are under which the intervention/time interaction should be included. I have seen all of the following iterations on the forum:
1. xtmixed score i.intervention i.time i.rural || hospital:, var reml
2. xtmixed score i.intervention#time i.rural || hospital:, var reml
3. xtmixed score i.intervention i.intervention#time i.rural || hospital:, var reml

Can someone help me sort this out? I really want to have a good understanding of these models and just keep getting more confused the more I read.

Thank you,

Sarah