Programming the statistical procedures from SAS

A question about Linear Mixed Model

Occasional Contributor
Posts: 14

A question about Linear Mixed Model

Hi all,

I am trying to examine the effect of re-admission to a hospital for the same illness on treatment length. I have a dataset that look like the following:

id   #admission  treatment_length

1      1                   10

1      2                   15

1      3                    20

2      1                    5

3      1                    8

3      2                    12 

For example, for patient id 1, he or she spent 10 days on his first admission. Later, he or she spent 15 days on his second admission, and 20 days on his third admission.

I am testing the hypothesis that each time a patient re-admits into a hospital, the required treatment length increases.

Therefore, the stat equation looks like follows:

Treatment_Length = Intercept + #Admission + id_random_effect + error

I wonder if I also need to specify the covariance structure of the error term? I feel strange that I would need to do so, because #Admission is already a predictor variable. Therefore, if I need to specify the cavariance structure of the error term (R matrix) I would base it on #Admission. If I need to do so, do SAS allows the same variable being specfied as both the fixed effect and the effect in R matrix.

Thanks for your help!


Frequent Contributor
Posts: 75

Re: A question about Linear Mixed Model


using a random intercept for each subject is in fact analogous to using a compound symetry / exchangeable covariance structure. in essence specifying a random intercept says that the correlation between any pair of repeated measurement is the same regardless the distance between admission time. if you dont think this is true you could also specify a covariance structure for the error term:

proc mixed data=xxx;

class id admission;

model treatment_length = admission;

repeated admission / sub=id type=ar(1); /* or some other covariance structure */

random intercept / sub=id;


essentially what this does is give you a hybrid covariance sturcture that says that the correlation between measurements are not constant but also do not decrease as fast as an ar(1) structure would have them do

to answer your other question, sas does allow the same predictor to be used in the class, model, and repeated/random statement. the only caveat is if for example you had recorded the time points for each longitudinal measure and wanted to use the actual time values as a continuous predictor in your model, then you would have to create a new variable time2=time and put time2 in the class statement to be used with the repeated/random statement.

maybe a better option (if you had the data) would be to use time that admission occured compared to the baseline time of the first admission. that way you would be able to exploit the time between admission. i would assume that some patients return to the hospital faster than others??? just a thought


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation