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

st: Cross-classified Random Coefficient Model with xtmelogit

From   Troy Hegel <>
Subject   st: Cross-classified Random Coefficient Model with xtmelogit
Date   Tue, 15 Apr 2008 20:16:46 +0200

Hello Statalister's,

I am hoping someone may be able to help me with my syntax for a random coefficient model using xtmelogit.

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.

Unfortunately I do not have access to either the Stata 10 User Manuals, nor Multilevel and Longitudinal Modeling Using Stata (by Rabe-Hesketh and Skrondal), which
I surmise would have a solution to my problem. R. Gutierrez's presentation from the 2007 N. American Stata Users Group Meeting (
has been very helpful thus far.

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)

Note: factor variables specified; option laplace assumed

Refining starting values:
initial vector: matrix must be dimension 5

I understand that by using the _all syntax (_all:R.Year) I have converted all my data into one panel and that Herd is now nested hierarchically within it. It seems to me
that I should now be able to specify the random coefficient for Herd. Would someone have some advice on how to write the command for this?

Error message r(503) reads:
"error . . . . . . . . . . . . . . . . . . . . . . . . Return code 503
conformability error;
You have issued a matrix command attempting to combine two
matrices that are not conformable, for example, multiplying
a 3x2 matrix by a 3x3 matrix. You will also get this message
if you attempt an operation that requires a square matrix and
the matrix is not square."

Unfortunately this message is somewhat beyond me with respect to how it relates to what I am trying to do.
I have searched the Statalist archives etc... but haven't found an example that will assist me here. My apologies if I have missed something already discussed.

Thank you very much,

Troy Hegel

* For searches and help try:

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