Using REPEATED and RANDOM statement in MIXED (WORD)

advertisement
Some comments on PROC MIXED.
Suppose I have 6 tanks, 3 with species C clams and 3 with species L clams and I measure
Y = opening of clam shells at times 1 through 4. After time 2 I introduce some toxin into
the water. At this point I have something like a split plot
Species
Error A
Toxin
S*T
Error B
1 factor A symbol 
4 (= tanks(species)) symbol D
1 factor B symbol 
1 symbol 
16 symbol e
Now the model using the above symbols is
Yijk =  + i + Dik + j + ()ij + eijk
where t is time. The underlined items are random variables with mean 0 and variances d2
and 2. This means that each Y has variance d2 +2 while two measurements from the
same tank yijk and yitk have the same D but different e’s so the covariance is the variance
of D, namely d2 IF the e’s are uncorrelated. Thus the four measurements in a tank have
covariance matrix
  d2 + 2

2
 d
  d2

2
 d
 d2
 d2
 d2 

 d2 + 2
 d2
 d2 
 d2
 d2 + 2
 d2 

 d2
 d2
 d2 + 2 
Now any matrix with something (say A) along the diagonal and something else (say B) in
every other position, like the matrix above, is called “compound symmetry”. How does
SAS know to build this matrix for each tank, that is, how does it know that it is a 4x4
matrix, the same for each tank? That is the role of the option subject=tank.
Now if we say
PROC MIXED; CLASS TANK SPECIES TOXIN;
MODEL Y=SPECIES|TOXIN;
RANDOM TANK;
this tells SAS about the D in our model and since the default assumption on e is a
diagonal matrix the effect is to take the diagonal matrix (with 2 on the diagonal) and add
something (d2) everywhere thus getting the SAME thing as if we had used
REPEATED /TYPE=CS SUBJECT=TANK;
This means that if we used both, the procedure would likely not converge! Anytime your
matrix (say compound symmetry CS) is of the same type when a constant is added
everywhere, the you cannot use both random and repeated statements. This would be true
for UN and Toeplitz as well – for example a Toeplitz matrix looks like
ABCD
BABC
CBAB
DCBA
So adding 5 to everything we would still get this striped (Toeplitz) form. With AR(1)
things are different. AR(1) is a Toeplitz matrix with B = A, C=2A, etc. so the elements
decay to 0. If you add 5 to everything the elements now decay to 5, not 0, so it is NOT
AR(1). Returning to our example, suppose we now think that within the same tank,
measurement h units apart in time have correlation .8|h| . Our AR(1) matrix is now
 1 .8 .64 .51 


.8 1 .8 .64 
but my model suggests adding d2 everywhere and then I do not
2
 .64 .8 1 .8 


 .51 .64 .8 1 
have AR(1) any more Thus in this case I MUST use both statements.
PROC MIXED; CLASS TANK SPECIES TOXIN;
MODEL Y=SPECIES|TOXIN;
RANDOM TANK;
REPEATED /SUBJECT=TANK TYPE=AR(1);
If I had =0 instead of =.8, notice that this would reduce back to compound symmetry.
For any form of matrix in the REPEATED statement, ask yourself if adding a constant
everywhere leaves you in that same form (with just different numbers). IF so, you cannot
also use a random statement. If not, then adding a random statement gives you a new and
potentially superior model.
Download