    # st: xtmixed how to fit a certain model which I can fit in SAS procmixed

 From "Jonathan Bartlett" To Subject st: xtmixed how to fit a certain model which I can fit in SAS procmixed Date Mon, 26 Jun 2006 15:18:43 +0100

```Dear all

I am trying to fit the following hierarchical model using xtmixed,
where y(ijk) represents the change in a variable for the i'th subject
between the j'th and k'th measurement occasions:

y(ijk) = u(ik) - u(ij) + e(ijk)

where u(ij) are normally distributed with a common variance, and e(ijk)
is an independent residual term, i is the subject identifier and j and k
are observation occasions.

For example suppose each subject has two observations, y(i12) and
y(i23). Then the model is

y(i12) = u(i2) - u(i1) + e(i12)
y(i23) = u(i3) - u(i2) + e(i23)

In SAS Proc Mixed I can fit this model by creating variabes u1, u2, u3
such that for y(i12), u1=-1, u2=1, u3=0 and similarly for y(i23), u1=0,
u2=-1, u3=1. A random statement in Proc Mixed

random u1 u2 u3 / type=toep(1) subject=id

then fits this model, making the three u's independent but sharing a
common variance term.

Using xtmixed I have tried

xtmixed y || id: u1 u2 u3, cov(identity) noconstant

but Stata then drops one of u1, u2, u3 because it says they are
collinear (which is true). But the u(ij) terms in the model are not
collinear (I don't think), which is why the model can be fitted in SAS.

Any ideas how I can fit this model using xtmixed in Stata?

Many thanks
Jonathan Bartlett
*
*   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/
```