I'm trying to run a cross classified model using panel data and I was hoping to get some help to verify if I'm on the right track with my code. I apologize if this is a basic question but I'm pretty new to stata and stats in general.
My data looks at how student achievement is impacted by environmental factors, for simplicity sake let's just say it's air pollution. I have 4 years worth of data and in year 3, there was a major event that lead to a drop in air pollution during that year, which started going up again in the 4th year. Air pollution data was collected at the school level, and at the student neighbourhood level. Based on this structure, I believe I should be using a cross classified model.
Here's an example of my data:
Student_ID | SCHOOL | Income | time | Mark | School_Pollution | Home_Pollution | Student_Neighbourhood |
1 | Blue | $ 92,416 | 1 | 77 | 0.348 | 0.439 | 1 |
1 | Blue | $ 92,416 | 2 | 66 | 0.415 | 0.505 | 1 |
1 | Blue | $ 92,416 | 3 | 64 | 0.407 | 0.489 | 1 |
1 | Blue | $ 92,416 | 4 | 15 | 0.357 | 0.469 | 1 |
2 | Blue | $ 136,448 | 1 | 85 | 0.479 | 0.472 | 2 |
2 | Blue | $ 136,448 | 2 | 78 | 0.535 | 0.536 | 2 |
2 | Blue | $ 136,448 | 3 | 78 | 0.523 | 0.529 | 2 |
2 | Blue | $ 136,448 | 4 | 90 | 0.466 | 0.462 | 2 |
3 | Green | $ 136,448 | 1 | 72 | 0.31 | 0.415 | 2 |
3 | Green | $ 136,448 | 2 | 51 | 0.372 | 0.483 | 2 |
3 | Green | $ 136,448 | 3 | 50 | 0.343 | 0.471 | 2 |
3 | Green | $ 136,448 | 4 | 7 | 0.31 | 0.443 | 2 |
Now I've been trying to write the code, and this is what I've come up with so far, but I've just cobbled it together from examples that I've seen in the online course from here:
https://www.cmm.bris.ac.uk/lemma/mod...93&pageid=1042
and here:
https://www.statalist.org/forums/for...assified-model
Anyways, this is the code that I've come up with so far:
Code:
xtmixed Mark i.time School_Pollution Home_Pollution Income || _all: R.SCHOOL || Student_Neighbourhood: Home_Pollution, mle variance
0 Response to Cross Classified Model using Panel Data
Post a Comment