# st: RE: comparing model with gllamm

 From "Maarten Buis" To Subject st: RE: comparing model with gllamm Date Fri, 24 Nov 2006 09:07:37 +0100

```--- stata_user stata_user wrote:
> I would like to compare between two  non nested models, I am using gllamm
> with a continuous  outcome and a mixture of discrete and continuous
> independent variables.
>
> Model 1: includes a variable X1 as continuous
> Model2: includes a decrete version of X1

In some cases model 1 and model 2 are nested. Imagine an ordered variable
with three levels. If we think that the effect of moving from level 1
to level 2 is the same as the effect of moving from level 2 to level 3,
then we can constrain the two effects to be the same by adding that
variable as a continuous variable. If we add the variable in a discrete
way, by adding two dummies, then we relax that constraint. So in this
case the models are nested and a likelihood ratio test of the two models
would be a test of the hypothesis that the effect of moving from level 1
to level 2 is the same as the effect of moving from level 2 to level 3.

Things get more complex if you also group different levels together. For
instance a variable age, measured in years, as a continuous variable and
the discrete variables are dummies for people aged between 20-29, 30-39,
40-49, etc. The reason you would want to compare these models is probably
because you think that the effect of age might be non-linear. Alternative
ways to add non-linear effects that are nested with the linear effect of
that variable are:
1) adding polynomials of that variable. In that case adding them as
orthogonal polynomials is nice, see: -help orthpoly-.
2) adding splines, see -help mkspline-.

HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

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