I tried to conducted a repeated measure using proc mixed with below data:
ID sex time outcome
1 F 1 30
1 F 2 23
2 M 1 23
2 M 2 22
3 M 1 12
3 M 2 34
The group is unbalanced, and each person was measured twice with two different time points. I could use paired t test, but I also need to compare gender, so I used the proc mixed to test the model
proc mixed data=have;
class times sex;
model outcome=sex|time/ solution CL residual outp=predresid;
repeated time/subject=id type=un;
run;
proc univariate normal plot data=predresid;
var resid;
run;
However, the residual was not normal after fitting the model. What test should I use for this kind of situation? I looked up online, someone said I should use Friedman's test, but the example code seems used 'ID' as block, and their code are pretty much like:
PROC FREQ DATA=have;
TABLES id*time*outcome / CMH2 SCORES=RANK NOPRINT;
run;
But I still have sex to be tested, can I put like id*time*sex*outcome, or there are something else that I can use? Thank you!
Two part answer here. First a reply to @Ksharp : After fitting a model, the residuals may or may not be normal (Gaussian). For example, if you fit binomial data without accounting for the distribution with a link function, the residuals will not look Gaussian (it might take a lot of data). Second a reply to @SAS-questioner : If you only have 6 data points, why are you bothering to fit a model? The mixed model or GEE model parameters will have such large standard errors you probably won't be able to correctly infer from them.
SteveDenham
Thank you for the reply. My data is not just 6 data points, I just want to show the format of the data. Also the outcome itself is not normal at all, and I also tried to check the distribution of the residual, it is not normal also. If I want to use non-parametric, I don't think it can test sex at the same time, right?
Question (actually a trick question) - how do you know that the distribution for residuals is not normal? Did you do some sort of test? There are well-known issues with almost every hypothesis test for normality (overpowered with N greater than about 40, underpowered for N less than about 15), and the linear mixed model is remarkably robust to the assumption of normality of the residuals, so long as the empirical distribution is mono-modal, not truncated, and lacks extremely large absolute values. The mono-modal basically boils down to sex differences.
So here are some ways to attack the issue, from simple to complex:
Given what you have done so far, I would recommend #4. You can use most of your PROC MIXED code, and you can examine each distribution/link to see which best fits your data.
SteveDenham
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.