Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: xtmelogit crossed and nested random effects

From   "Alison K. Levin-Rector" <>
To   "''" <>
Subject   st: xtmelogit crossed and nested random effects
Date   Sun, 26 Sep 2010 13:04:32 -0700


I am trying to run a mixed effects model in Stata that duplicates some code in R that is as follows:
m08Gt<-glmer(hiv~age+urban_rural+literacy+(1|site)+(1|district)+(1+grants_percapita|state)+(1|year:AStatus)+grants_percapita, family='binomial', data)

Each observation in my dataset is a district in India which is composed of 1-6 sites and is located within a state. Some districts have received an intervention and some have not. Within the districts that have received an intervention, each has received a varying degree of grant money, which is expressed in grant money per capita population in that district. There are 35 states in India.

For those that don't use R, the model is aiming to estimate:
A fixed effect on average age, percentage urban, proportion literate, and grant money per capita.
A random intercept on site regardless of state or district.
A random intercept on district regardless of state.
A random intercept on state.
A random intercept on year nested in the intervention status of a district, which is coded as 1 or 0.
A random slope on grant money per capita estimated independently for each state.

I am having a hard time specifying a model that can estimate a random intercept on year by intervention status and at the same time estimate a random slope on grant money per capita by state. It seems that you can only have one nested relationship within a model.

For example, if the model I specify is as follows:
xtmelogit hiv age urban_rural literacy grants_percapita || _all:site || _all:district || _all:state || state:grants_percapita || astatus: || year:

I believe that both astatus (intervention status) and year are estimated independently by state. Is there any way to write this so that they are estimated across the whole country regardless of state?

Alison Levin-Rector

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index