# Mixed Model in SAS

I want to analyse the data from an experiment.

The participants get different acoustic signals and judge them. The score is a high number, if they feel comfortable with the signal in the other case it is a lower number. I have 5 different signals and 15 participants. The experiment was performed 5 times for each subject, so I've get 65 values.

I want to use a mixed model. I get different results from SPSS and SAS and cannot find the error. It could be that I used PROC MIXED wrong.

proc mixed data=ein1;
class Signal ProNr;
model se = Signal;
random ProNr;
repeated /subject=ProNr;
run;
quit;


The result is:

                                    Die Prozedur MIXED

Covariance Parameter Estimates

Kov.Parm     Subjekt    Schätzwert

ProNr                            0
Residual     ProNr          112855

Anpassungsstatistiken

-2 Res Log-Likelihood           881.1
AIC (kleiner ist besser)        883.1
AICC (kleiner ist besser)       883.2
BIC (kleiner ist besser)        883.7

Typ 3 Tests der festen Effekte

Zähler            Nenner

Signal                     4                48           1.00    0.4169


Did I choose the right parameters? I think that the result says that Signal isn't significant (0.4169 > 0.05). Is this the right interpretation of the results? I used in SPSS an anova with repeated measurements. SPSS corrected the results an the result with greenhouse geisser correction is 0.013. Why this results are so different?

EDIT1: The data looks like:

se   Pro_Nr signal
3.4799  1   1
3.3682  2   1
4.3217  3   1
2.9976  4   1
5.5861  5   1
6.7242  6   1
2.6379  7   1
1.9341  8   1


Pro_nr contains values from 1 to 15, every subject get one special number. signal contains numbers from 1 to 5. Each signal gets its own number.

Edit2: Proc glm isn't the right procedure to analyse this data, because no group variable can be defined. I have to use proc mixed for this problem.

Edit3: Is it possible to compare the results of an anova and a mixed model? Did I get the same results with both analyses?

New code:

PROC MIXED DATA=ein1;
CLASS Frequ ProNr;
MODEL se = Frequ;
REPEATED / subject=ProNr type=cs;
RUN;
QUIT;


Did I formulated the model (and so the program code) right to answer the question, wheater se depends on frequ (under the random and repeated effect of subjects)? Do you have some favourite literature to mixed models?

• Note that the ligne REPEATED is useless here. What did you expect about this line ? Could you describe your model in mathematical terms ? Apr 17 '12 at 17:47
• The model looks like se = beta * signal + b * ProNr. I want to handle the signal as fixed effect and ProNr as random effect. I think it is the same like a repeated measurement anova, isn't it? Apr 17 '12 at 19:19
• This is really not clear enough. The variables "signal" and "ProNr" are qualitative or quantitative ? Could you edit your post and add a piece of your dataset ? Apr 17 '12 at 19:25

SPSS performs "repeated measures ANOVA", which can be done in SAS through PROC GLM, and not PROC MIXED. The latter can be used for repeated measures models, but the specific assumptions are somewhat different. UCLA has a wonderful page which explains how to do repeated measures ANOVA in SAS.

EDIT

Based on your comments, you are not actually trying to replicate SPSS's repeated measures ANOVA, but do a different analysis. As noted by Stephane, your PROC MIXED syntax is not quite right: you don't need both a random and a repeated statement (in this case). If you are looking for a compound symmetry structure (equal correlation), then either

RANDOM ProNr;


or

REPEATED / subject=ProNR type=cs;


would work, but you don't need both. With the REPEATED statement you can use more complicated correlation structures if needed, the RANDOM statement locks you into equal correlation (which is a more restrictive assumption than that of repeated measures ANOVA).

• It would be more clear if speecie provides the SPSS code. And I would be surprised that something can be done in SAS through PROC GLM but not PROC MIXED, are you sure ? Apr 17 '12 at 19:27
• PROC MIXED uses likelihood based estimation, while PROC GLM does the sum-of-squares approach. They also treat missing values differently. The Greenhouse-Geisser correction for sphericity is the giveaway: it is only used during repeated measures ANOVA. PROC MIXED can be used to perform a correct (and arguably preferable) analysis, but the results will not be identical. Apr 17 '12 at 19:40
• Thank you for this link. This page is very useful. I tried to analyse the data with proc glm. The p-value ist 0.4148. I get the same with proc anova. So, I am not sure my model is wrong or the analysis in spss. I am a little bit confused, too. Shouldn't I get the same results with a mixed model and an anova? If they don't have the same results, why? I thought a mixed model is just a more general model then the Anova. And I get an error: Repeated measures analysis requires multiple dependent variables. Does it mean rm-anova is the wrong model to analyse this data? Apr 18 '12 at 9:23
• You need to set up your data in the "wide" format for PROC GLM: the five measurements on the same subjects should be 5 variables in one observation. Apr 18 '12 at 12:23
• I thought that this could be the problem, but I was not sure how to fit the function. The problem is I cannot write a group variable in the row and so I don't how to fit the function. I think, that model should thus look like: signal1 signal2 signal3 signal4 signal5 = ... . Instead of ... should there be the signal strength, but I have no variable for it and I am not sure how to create a variable for the signal strength, because every measurement point has its own signal strength and so I cannot wrote the coding number for it in the row. How can I solve this? Apr 18 '12 at 13:01