Statalist


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

st: How to specify random factor in xtmelogit (LogReg w/ random factor)


From   Susan Lingle <[email protected]>
To   [email protected]
Subject   st: How to specify random factor in xtmelogit (LogReg w/ random factor)
Date   Thu, 15 Nov 2007 16:09:30 -0700

Dear Stata-listers

Apologies in advance if my question is too rudimentary. I am new to Stata and have been figuring out how to deal with categorical factors as independent variables the last couple of days (by turning them into indicative variables). I am now wondering whether I need to do anything special when including a random factor in an analysis.

I am looking at the effect of three fixed factors including species (2 species), year (7 years), and area (4 areas) on the survival of deer fawns. I have 147 deer fawns from 127 mothers and want to use the mother's identity as random factor to control for family effects (the survival of twin fawns is unlikely to be independent).

Do I simply 'tell' Stata to treat mother identity as a random factor (a grouping factor)? Or do I need to somewhere specify that this is a grouping or categorical factor. Clearly I do not want to create 126 indicative new variables from the mother's identity, the process one would follow when using categorical fixed factors!

I will paste in the commands I used and also the output. I am only interested in the effect of the fixed factors. I only include mother's identity to control for that variable (not to assess its effects).

I was surprised to see that the effect of species is far weaker in this analysis than it was when I ran a logistic regression that excluded the 20 twins (i.e. only using 1 fawn per mother), for which I did not need to include a random factor.

Thanks so much for any insight you can provide.

Susan


xi: xtmelogit WinterSurv speciesno i.year i.winterareano, || motheridno:, covariance(independent)

i.year _Iyear_1994-2005 (naturally coded; _Iyear_1994 omitted)
i.winterareano _Iwinterare_1-4 (naturally coded; _Iwinterare_1 omitted)
Note: single-variable random-effects specification; covariance structure set to identity

Refining starting values:

Iteration 0: log likelihood = -72.506965 Iteration 1: log likelihood = -71.738377 Iteration 2: log likelihood = -71.639325
Performing gradient-based optimization:

Iteration 0: log likelihood = -71.639325 Iteration 1: log likelihood = -71.638967 Iteration 2: log likelihood = -71.638967
Mixed-effects logistic regression Number of obs = 147
Group variable: motheridno Number of groups = 127

Obs per group: min = 1
avg = 1.2
max = 2

Integration points = 7 Wald chi2(10) = 6.62
Log likelihood = -71.638967 Prob > chi2 = 0.7608

------------------------------------------------------------------------------
WinterSurv | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
speciesno | -3.383566 1.626545 -2.08 0.038 -6.571536 -.1955957
_Iyear_1995 | 2.469029 1.420471 1.74 0.082 -.3150429 5.253102
_Iyear_2000 | 2.711117 1.730716 1.57 0.117 -.6810241 6.103259
_Iyear_2001 | 2.751563 1.862746 1.48 0.140 -.8993519 6.402478
_Iyear_2003 | -.3852582 1.448119 -0.27 0.790 -3.223519 2.453003
_Iyear_2004 | 4.209779 2.282672 1.84 0.065 -.2641753 8.683733
_Iyear_2005 | 4.307069 2.250629 1.91 0.056 -.1040832 8.718222
_Iwinterar~2 | 1.477567 1.264967 1.17 0.243 -1.001722 3.956857
_Iwinterar~3 | 3.386436 1.83254 1.85 0.065 -.2052769 6.978149
_Iwinterar~4 | .5591356 1.529517 0.37 0.715 -2.438663 3.556934
_cons | 3.08273 2.351341 1.31 0.190 -1.525813 7.691273
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
motheridno: Identity |
sd(_cons) | 1.88 1.239339 .5164477 6.843673
------------------------------------------------------------------------------
LR test vs. logistic regression: chibar2(01) = 2.08 Prob>=chibar2 = 0.0748



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