Programming the statistical procedures from SAS

Proc Mixed: how to obtain transformed residuals and predictors

Frequent Contributor
Posts: 75

Proc Mixed: how to obtain transformed residuals and predictors

Hello all,

I am working on a longitudinal data set and I want to asses the fit of my model. Since my observations are naturally correlated I cannot use the residuals from the OUTPM data set to perform classic linear regression residual analysis. However in PROC MIXED you can use the opton VCIRY in the MODEL statement that will give the scaled residuals (called Scaled Residuals in the data set of OUTPM) that now can be used in the classic plot of predicted values vs residuals. But here is my problem: I also need to get scaled predicted values but dont know how to generate them.

The mathematical procedure is quite easy: for every subject in the study, you find their estimated covariance matrix S and take the choleski decomposition of S. This gives you S=L*L', where L is a lower triangular matrix. Now you multiply L inverse by the original residual vector for subject i and thats how we get the Scaled Residual vector found from VCIRY.

To get the scaled predicted values you do the same with the original predicted values, namely L^-1 * original.pred.values.

How can I tell SAS to get me these values? I can get the choleski inverse for each subject by using the option rci=(subject number) in the REPEATED statement or vci in the RANDOM statement but that would be nearly impossible for me to manually calculate the scaled pred values for all my subjects.

Is there a way I can write a command/script that takes the choleski inverses for all the subjects in proc mixed and transforms my original values? Something like:

for (i in 1 to number of subjects){
scaled predicted of subject i = (rci=i) * original predicted value of subject i

Hopefully someone can help me
Thanks for reading :-) Message was edited by: trekvana
Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation