HsienYuan Hsu <[email protected]> writes:
> I am tring to model heterogeneity in level 1 residual variance (sigma^2).
> In my model, I have
> DV: mathach
> IV: Female
> If I use the syntax:
> xtmixed mathach female || id:female , cov(unstruct) nocons , ml
> It gives me "one sigma^2. However, I want to model the sigma^2 for male and
> female, respectively. Does any expert know the syntax?
Modeling observation-level heterogeneity requires first creating a variable
identifying the observations and then explicitly adding this level to the
model
. gen obs = _n
. xtmixed mathach female || id:female, cov(unstruct) nocons ///
|| obs:female, nocons ml variance
When you fit this model, the variance component for the "obs" level represents
the added variability due to being female at the residual level.
Mathematically, sigma^2 for males is var(Residual) as labeled in the output;
sigma^2 for females is var(Residual) + var(female), for var(female) as given
in the "obs:" level of the model.
If this model does not converge, it is most likely because there is no added
variability due to being female -- sigma^2 for females is actually less than
that for males. No problem -- simply reverse the coding
. gen male = 1 - female
. xtmixed mathach female || id:female, cov(unstruct) nocons ///
|| obs:male, nocons ml variance
and now sigma^2 for females is var(Residual) and that for males is
var(Residual) + var(male).
--Bobby
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/