How to model three cluster levels in a population-averaged model in Stata (using xtgee)

22 views
Skip to first unread message

Megan Carter

unread,
Jan 16, 2014, 1:06:12 PM1/16/14
to stata-us...@googlegroups.com

I am using xtgee in Stata to model change in consent rates over time. I have three levels (time, students, and schools). I am modeling only two time points - consent before (0/1) and consent after (0/1). Currently my model looks like this:

xtgee wcon ib1.time, fam(poisson) link(log) i(studentid) t(time) corr(uns) robust eform

This model only adjusts for time within students, not schools. I have looked across the interwebs and in various books but can't seem to find how I would code school as a third level.

I've tried to add SchoolID to xtset, but it tells me I have too many variables (there are already time and studentid added). I've also tried to add SchoolID to i() directly in the model, but I get the same error.

Any help is appreciated

Reply all
Reply to author
Forward
0 new messages