 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: xtmixed model

 From "Grove-White, Dai" To "statalist@hsphsun2.harvard.edu" Subject st: xtmixed model Date Sat, 26 Feb 2011 19:30:30 +0000

```Dear list
I am relatively new to multi level modelling so please excuse the query if silly!  I am running a mixed effects linear model on a weight loss study.  Due to the large range of horses and small number (n=12 horses and weight range is 200 - 600kg) I am modelling the weight loss as a proportion of the weight at the start of the study transformed as arcsin(square_root wt_proportion)
the model is
. xtmixed  transprop_wt week c.week#c.week ||id: week, var
Performing EM optimization:
Iteration 0:   log restricted-likelihood =  366.38495
Iteration 1:   log restricted-likelihood =  366.38495
Computing standard errors:
Mixed-effects REML regression                   Number of obs      =       192
Group variable: id                              Number of groups   =        12
Obs per group: min =        16
avg =      16.0
max =        16

Wald chi2(2)       =    273.25
Log restricted-likelihood =  366.38495          Prob > chi2        =    0.0000
------------------------------------------------------------------------------
transprop_wt |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
week |  -.0307454   .0020573   -14.94   0.000    -.0347776   -.0267131
|
c.week#|
c.week |    .001064   .0001071     9.94   0.000     .0008541    .0012739
|
_cons |    1.58295   .0137351   115.25   0.000     1.556029     1.60987
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Independent              |
var(week) |   8.70e-06   4.62e-06      3.07e-06    .0000246
var(_cons) |   .0016897   .0007985      .0006692    .0042662
-----------------------------+------------------------------------------------
var(Residual) |   .0007861   .0000862      .0006341    .0009746
------------------------------------------------------------------------------
LR test vs. linear regression:       chi2(2) =   184.98   Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
.
where week is week of study - I have put in week squared since it improves model fit as judged by LR test.  When I plot out fitted values the starting value ie for week 1 is different for different horses.  This does not seem logical since the proportional weight of all horses at the start should be the same (= 1.0) by definition as should the transformed prop_weight.  In fact it seems that maybe I should not have a random intercept at all ie just have a random slope model.  Is that correct and if so what would the code be for a model with random slope only. Would it be

xtmixed  transprop_wt week c.week#c.week ||week:, var
Performing EM optimization:
Iteration 0:   log restricted-likelihood =  273.52452
Iteration 1:   log restricted-likelihood =  273.89258
Iteration 2:   log restricted-likelihood =  273.89262
Iteration 3:   log restricted-likelihood =  273.89262
Computing standard errors:
Mixed-effects REML regression                   Number of obs      =       192
Group variable: week                            Number of groups   =        16
Obs per group: min =        12
avg =      12.0
max =        12

Wald chi2(2)       =    258.25
Log restricted-likelihood =  273.89262          Prob > chi2        =    0.0000
------------------------------------------------------------------------------
transprop_wt |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
week |  -.0307454   .0035542    -8.65   0.000    -.0377115   -.0237792
|
c.week#|
c.week |    .001064   .0002032     5.24   0.000     .0006656    .0014624
|
_cons |    1.58295   .0131277   120.58   0.000      1.55722    1.608679
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
week: Identity               |
var(_cons) |   8.86e-26   8.60e-25      4.84e-34    1.62e-17
-----------------------------+------------------------------------------------
var(Residual) |   .0028315   .0002913      .0023145    .0034641
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) =  3.4e-13 Prob >= chibar2 = 1.0000

Many thanks

Dai

Dai Grove-White BVSc MSc DBR PhD DipECBHM FRCVS
Livestock Health & Welfare
School of Veterinary Science
Leahurst Campus
University of Liverpool