# Aligned rank transform with random factor

#### leckerschmecker

##### New Member
In a book, I've found SPSS syntax for performing an aligned rank transformation in a two way ANOVA.

The procedure is:
- save residuals by performing a standard ANOVA
- use Aggregate to determine effects for group means (mij for interaction, ai as first factor, bj for second factor)
- eliminate interaction effect from residual to determine interaction (ran), eliminate single effects to determine main effects (ra)

Interaction effect: ek – (αβij – αi – βj + μ)
Main effects: ek – (αi + βj–2μ)

- transform residuals into ranks - run complete model on these ranks for interaction / main effects, respectively

The syntax is:

Code:
Unianova  x by group drugs
/save=resid (rab)
/design=group drugs group*drugs.
Compute ra=rab.
Aggregate
/break=group drugs    /mij=mean(x).
Aggregate
/break=group    /ai=mean(x).
Aggregate
/break=drugs    /bj=mean(x).
Aggregate
/break=         /mm=mean(x).
Compute rab=rab-(mij - ai - bj + mm).
Compute ra=ra-(ai + bj - 2*mm).
Rank variables=ra rab (A)
/rank into rar rabr.
Unianova  rabr by group drugs
/design=group drugs group*drugs.
Unianova  rar by group drugs
/design=group drugs group*drugs.
Now I would like to adapt this to my design, which has an additional random factor "subjects".

My initial ANOVA syntax would look like this:

Code:
Unianova x by condition repetition subject
/random=subject
/method=SSTYPE(3)
/intercept=INCLUDE
/save=RESID (rab)
/criteria=ALPHA(.05)
/design=condition repetition subject condition*repetition condition*subject repetition*subject.
However now I'm not sure how to include the third random factor in the subsequent aligned rank transform procedure.

This is my first version of the story:

Code:
Aggregate
/break=condition repetition    /mij=mean(T1).
Aggregate
/break=condition    /ai=mean(T1).
Aggregate
/break=repetition    /bj=mean(T1).
Aggregate
/break=subject    /ck=mean(T1).
Aggregate
/rank into rar rabr.