= A note about using ranked outcomes in t-tests and ANOVAs = This note aims to show the state-of-play on the use of ranked responses in analysis of variance particularly with regard to testing for interactions. Conover and Iman (1981) showed that the Mann-Whitney test is equivalent to a t-test on ranked responses. Huitema (1980) in Chapter 12 and Shirley (1981) illustrate the use and interpretation of an analysis of covariance on ranked outcomes with worked examples. Shirley (1987) extends Conover and Iman's work to investigating interactions by presenting a worked example involving a full factorial between subjects analysis of variance. Blair, Sawilowsky and Higgins (1987) and Wilcox (2003, p.604) do not advocate using ranked outcomes to test for interactions 'in more complex designs'. Thompson (1991) takes a conservative stance, stating that ANOVAs on ranked data can be used to test for interactions only "when there are exactly two levels of both main effects or when there is only one main effect" (p. 697). Akritas (1991) shows that rank transformed responses are not applicable to repeated measures ANOVA. Leys and Schumann (2010) present a step-by-step worked example which tests for an interaction in a pair of between subjects factor ANOVA (see [[http://www.sciencedirect.com/science/article/pii/S002210311000034X|here]]) using an adjusted rank transform with a working [[attachment:nonint.xls|input spreadsheet.]] This [[attachment:bbrint.xls|spreadsheet]] will work out a nonparametric two-way interaction for 2 between subjects factors (BB) each having two levels. The response and group raw data and number of cases are entered into Sheet1 and the results displayed in Sheet2. The calculations follow the method illustrated by the simple example in Leys and Schumann (2010). This approach involves testing the two-way interaction tests on ranked data when the main effects have been removed and is known as the adjusted rank transformation test (ART). A .exe file for use on windows to perform more general ART tests for nonparametric interactions for factorial ANOVAs is downloadable from [[http://depts.washington.edu/aimgroup/proj/art/ | here.]] Mansouri (1998) also presents some examples using SAS for looking at interactions between two between subjects factors (see [[http://www.sciencedirect.com/science/article/pii/S0167947398000772|here]]). Mansouri and Chang (1995) note down problems using rank tranforms when responses follow a Cauchy distribution and advocate using Normal scores to downweight the inflated Type I error. More recently Zimmerman (2011) has shown that using t-tests on ranked outcomes, even when there are a large proportion of equal scores (having tied ranks), have greater power and smaller type I error than the conventional t-test on raw scores when the outcome is not normally distributed. He also claims using ranked outcomes works well with one-way ANOVAs. An alternative strategy ignoring ranks altogether is to fit a generalized linear mixed model (GLMM) assuming responses are counts and follow a poisson distribution. In this way interactions for repeated measures data may be fitted e.g. to 20 people in one of four diagnostic groups each being assessed in three positions (lying, sitting and standing). One inputs data in 'long' format consisting of a single response with columns indicating subject, response, group and position. The GLMM can then be fitted in R reading a SPSS data file and using the syntax below. {{{ library(foreign) x <- read.spss("U://My Documents//WHIMINT.sav") x1 <- attach(x) library(foreign) library(lme4) int <-glmer( resp ~ position + grp + position*grp + (1|sub), data = x, family = poisson) }}} Edgington (1995) suggests using randomization (bootstrap) tests when sample sizes are small to obtain more robust p-values from parametric procedures such as ANOVAs using model fit statistics. This is succinctly done in R for the repeated measures using GLMMs - using the syntax below with a logged response to handle any skew in the response and with the difference in the Akaike Information Criterion (AIC) comparing model fits of the ANOVA with and without the interaction term as the fit statistic of interest. {{{ library(foreign) x <- read.spss("U://My Documents//WHIMINT.sav") x1 <- attach(x) library(lme4) int <-lmer( log(resp) ~ as.factor(position) + as.factor(poolgrp) + as.factor(position)*as.factor(poolgrp) + (1|sub), data = x) int2 <-lmer( log(resp) ~ as.factor(position) + as.factor(poolgrp) + (1|sub), data = x) diff <- AIC(int) - AIC(int2) nb<-1000 n <- length(resp) boot<-matrix(NA,nb,6) attributes(boot) for (i in 1:nb) { bs<-sample(resp,n,replace =F) int <-lmer( log(bs) ~ as.factor(position) + as.factor(poolgrp) + as.factor(position)*as.factor(poolgrp) + (1|sub), data = x) boot[i,1] <- AIC(int) int2 <-lmer( log(bs) ~ as.factor(position) + as.factor(poolgrp) + (1|sub), data = x) boot[i,2] <- AIC(int2) boot[i,3] <- AIC(int2) - AIC(int) } sum(boot[,3]