Hi Statalisters,

I have a panel dataset with around 30,000 individuals observed for four years all over the US. My dependent variable is a binary variable that depends on individual characteristics and state characteristics. I want to isolate the variance in my dependent variable across states while controlling for individual fixed effects. My approach has been to fit a multilevel model using the -mixed- command and -predict- to obtain the BLUP at the state level according to the following, where the individual identifier is ID and the state identifier is state:

Code:
mixed dependent_variable ID  || state:
predict  blup_state , reffects
My first question is whether this is actually the correct specification for the above stated purpose or whether I have to model the individual fixed effects also as random variables to obtain the correct variance decomposition.

Secondly, since I have worked with a different version of stata before, which didn't allow me to specify a model using the -mixed- command with such a high number of categorical variables to control for, I have partialed out the individual fixed effects manually and used the -mixed- command with the predicted residuals according to:

Code:
areg dependent_variable, absorb(ID)
predict dependent_variable_resid, resid
 
mixed dependent_variable_resid  || state:
predict  blup_resid_state, reffects
However, while I expected the standard errors to be incorrect I was under the assumption that the predicted results should be the same when compared with the results of the first specified model. But it turns out they are significantly different. Hence, my second question would be whether I missed something obvious here or misspecified the model.

Comments are greatly appreciated.