David Airey wrote:
Has anyone programmed the aligned-rank transformation for either
multifactorial or split plot designs? Findit finds nothing.
--------------------------------------------------------------------------------
The aligned-rank transformation seems to work reasonably well, if I got it
right. The complaints that I'm aware of about the Conover-Imam approach
(factorial ANOVA of ranks sans alignment) are that it doesn't control Type I
error rate for tests of the interaction term in the presence of a main
effect, and that it has poor power to detect interaction in the presence of
both main effects.
Below, with a nonnull main effect of one factor, the Type I error rates for
the other factor and the interaction term are 0.054 and 0.056 at the nominal
0.05; the rates run 0.047 to 0.052 under the omnibus null. The power to
detect an interaction is no lower than customary ANOVA in the presence of
both main effects--both 15% in the case below (delta of 1 SD increment each
level of each factor + 1 SD for interaction). The simulation below is of a
two-way factorial ANOVA layout with a normally distributed error in a
balanced dataset. You can modify the called program to see how well things
hold up under other circumstances.
Joseph Coveney
Conover, W. J., Iman, R. L. (1981). Rank transformations as a bridge between
parametric and nonparametric statistics. _The American Statistician_
35:124--129.
Seaman, J. W., Walls, S. C., Wide, S.E. and Jaeger, R.G.(1994) Caveat
emptor: rank transform methods and interactions. _Trends in Ecology and
Evolution_ 9:261--63.
clear *
set more off
set seed `=date("2002-08-28", "YMD")'
*
program define simem, rclass
version 10
syntax [, adelta(real 0) bdelta(real 0) abdelta(real 0) ///
n(integer 24)]
tempname p_A p_B p_AB
tempvar response A B A_removed B_removed AB_removed rank
set obs `n'
generate byte `A' = mod(_n, 2)
sort `A'
generate byte `B' = mod(_n, 3)
generate double `response' = `A' * `adelta' + ///
`B' * `bdelta' + !`A' * !`B' * `abdelta' + ///
invnormal(uniform())
* Alignment (setting up for later ranking and ANOVA)
foreach predictor in A B {
generate double ``predictor'_removed' = .
levelsof ``predictor'', local(predictor_levels)
foreach predictor_level of local predictor_levels {
summarize `response' if ``predictor'' == ///
`predictor_level', meanonly
replace ``predictor'_removed' = `response' - ///
r(mean) if ``predictor'' == `predictor_level'
}
}
generate double `AB_removed' = .
foreach predictor_level of local predictor_levels { // Still B
summarize `A_removed' if `B' == `predictor_level', meanonly
replace `AB_removed' = `A_removed' - ///
r(mean) if `B' == `predictor_level'
}
* Ranking and ANOVA
egen double `rank' = rank(`A_removed')
anova `rank' `A' `B' `A'*`B', sequential
scalar define `p_B' = Ftail(e(df_2), e(df_r), e(F_2))
drop `rank'
egen double `rank' = rank(`B_removed')
anova `rank' `A' `B' `A'*`B', sequential
scalar define `p_A' = Ftail(e(df_1), e(df_r), e(F_1))
drop `rank'
if (`abdelta') { // Customary ANOVA for power comparison
anova `response' `A' `B' `A'*`B'
scalar define `p_AB' = Ftail(e(df_3), e(df_r), e(F_3))
}
else scalar define `p_AB' = .
egen double `rank' = rank(`AB_removed')
anova `rank' `A' `B' `A'*`B'
return scalar p_AB = Ftail(e(df_3), e(df_r), e(F_3))
return scalar p_B = scalar(`p_B')
return scalar p_A = scalar(`p_A')
return scalar p_ABun = scalar(`p_AB')
end
*
* Omnibus H0
*
simulate A = r(p_A) B = r(p_B) AB = r(p_AB), ///
reps(10000) nodots: simem
foreach var of varlist A B AB {
generate byte pos_`var' = `var' < 0.05
}
summarize pos_*
*
* Ha for Factor A
*
drop _all
simulate A = r(p_A) B = r(p_B) AB = r(p_AB), ///
reps(10000) nodots: simem , adelta(1)
foreach var of varlist A B AB {
generate byte pos_`var' = `var' < 0.05
}
summarize pos_*
*
* Power for interaction term when omnibus Ha
*
drop _all
simulate ABrank = r(p_AB) ABun = r(p_ABun), ///
reps(10000) nodots: simem , adelta(1) bdelta(1) ///
abdelta(1)
foreach var of varlist AB* {
generate byte pos_`var' = `var' < 0.05
}
summarize pos_*
exit
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/