Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Cross-classified Random Coefficient Model with xtmelogit


From   [email protected] (Roberto G. Gutierrez, StataCorp)
To   [email protected]
Subject   Re: st: Cross-classified Random Coefficient Model with xtmelogit
Date   Tue, 15 Apr 2008 14:42:19 -0500

Troy Hegel <[email protected]> writes:

> I am trying to fit a cross-classified mixed model in which Herd (n=10) and
> Year (n=27) are cross-classified random effects. The number of observations
> for my model is 165.

[...]

> Using the following syntax I can fit a cross-classified random intercept
> model that yields sensible results:

> xtmelogit Calves Treat Adj April || _all:R.Year || Herd: , binomial(Cows)

> I am trying to fit "April" as a random coefficient on "Herd" and I thought
> that this syntax should work, but I get the subsequent error message:

> xtmelogit Calves Treat Adj April || _all:R.Year || Herd: April ,
> binomial(Cows)

[...]

> initial vector: matrix must be dimension 5 r(503);

[...]

Troy's syntax is indeed correct for the model he wishes to fit.  Instead, he
has uncovered a bug in the initial-values logic for -xtmelogit-, a bug that
can be triggered in the specific case of cross-classified random effects
models with random coefficients in addition to random intercepts.

We'll fix this in the next ado update.  In the meantime, Troy can work around
this bug by supplying his own initial values and by-passing the initial values
calculation altogether.  A vector of zeros should suffice, if not, Troy can
email me privately and I can suggest some alternatives.

   . mat b = J(1, 7, 0)
   . xtmelogit Calves Treat Adj April || _all:R.Year || Herd: April ,
               binomial(Cows) from(b)

The "7" in the above is for four fixed effects (three coefficients plus one
intercept) and three variance components; one at the Year level and two at the
Herd level (one random intercept and and one random coefficient on April).
Troy's error message indicates this number as "5", but it should be "7", and
in my tests to reproduce the bug it was.  In any case, the discrepancy won't
matter once the bug is fixed.

--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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index