Dear Stata experts,
I need your help with multilevel longitudinal panel data with a binary outcome. In our study, 20 000 students filled out 1 questionnaire per year on their screen time in 2018, 2019, 2021, 2022 (4 years). The student data is nested within 100 schools and 5 regions. We want to know whether the pandemic is associated with an increase in screen time. The outcome is binary (0= use screens less than two hours per day, 1= use screens two or more hours per day). The onset of pandemic happened once, at the same time for everyone (in 2021 and 2022). I’m thinking about using the command below but I think that this would only allow us to look at the evolution of screen time overtime. It wouldn't have a pandemic variable. Although maybe it's not a big deal since the pandemic overlaps with the year 2021 and 2022.
. melogit screen_dicho time0 i.sex urban || IdSchool || IdParticipant: t0, cov(uns)
An alternative would be to run a fixed-effects model to estimate changes in the adolescents’ screen time before and during the pandemic. However, I’m wondering how to manage the fact that schools are nested with such a fixed effects model. Would this command make sense?
. reghdfe screen_dicho time0, a(IdParticipant IdSchool) vce(cluster IdParticipant IdSchool)
Thanks,
Anne
I need your help with multilevel longitudinal panel data with a binary outcome. In our study, 20 000 students filled out 1 questionnaire per year on their screen time in 2018, 2019, 2021, 2022 (4 years). The student data is nested within 100 schools and 5 regions. We want to know whether the pandemic is associated with an increase in screen time. The outcome is binary (0= use screens less than two hours per day, 1= use screens two or more hours per day). The onset of pandemic happened once, at the same time for everyone (in 2021 and 2022). I’m thinking about using the command below but I think that this would only allow us to look at the evolution of screen time overtime. It wouldn't have a pandemic variable. Although maybe it's not a big deal since the pandemic overlaps with the year 2021 and 2022.
. melogit screen_dicho time0 i.sex urban || IdSchool || IdParticipant: t0, cov(uns)
An alternative would be to run a fixed-effects model to estimate changes in the adolescents’ screen time before and during the pandemic. However, I’m wondering how to manage the fact that schools are nested with such a fixed effects model. Would this command make sense?
. reghdfe screen_dicho time0, a(IdParticipant IdSchool) vce(cluster IdParticipant IdSchool)
Thanks,
Anne
Comment