FAQ/singcase - CBU statistics Wiki
location: FAQ / singcase

Comparing a within subjects group difference to that of a single case

Pairwise case

Suppose a group of controls and a single case do a pair of conditions (c1, c2, say) and we are interested in seeing if the relationship between the conditions in the controls is the same as that in the single case.

Since we have a single case we can treat its difference as a constant. So we end up with a one sample t-test on the control group difference minus the case difference. Ie we test if the mean difference in controls - difference in case equals 0.

A more conservative approach (implemented using the R code below) than the one-sample t-test has been proposed by Crawford and Howell(1998) substituting the control variance for the patient variance. Here c1 and c2 are the two conditions and sub denotes if the subject is a control or a case. There is some controversy over this more conservative approach (Crawford & Howell, 1998) which assigns the control group variance to the single subject (difference) score rather than treating it as a constant with zero variance, as in the one sample t-test (see e.g. Mycroft et al. (2002)).

These tests, therefore, assume that the slopes in the control and patient groups have the same variance. Crawford and Garthwaite present a detailed discussion of the methods available.

c1 <- c(2,1,2,3,1,2,2,1,1,3,3,1)
c2 <- c(3,4,1,1,6,1,3,2,2,5,2,2)
sub <- c(1,1,1,1,1,1,1,1,1,1,1,2)
diff <- c1–c2
diffn <- diff[sub == 1]
diffp <- diff[sub == 2]
diffy <- diffn - diffp 
const <- gl(1,length(diffn))
id <- gl(length(diffn),1)
t.test(diffy, mu=0)
df <- length(diffn)-1
nc <- sum(as.numeric(sub==1))
toutc <- (mean(diffn)-diffp) / sqrt(var(diffn)*((nc+1)/nc))
pv <- 2*pt(-abs(toutc), df)

Alternatively a nonparametric sign (binomial) test could be performed if there is only a small numer of possible outcomes comparing a single subject outcome with those of the controls. The ratiionale of the sign test is that if the subject outcome is 'typical' of those from the control group there should be equal numbers of control outcomes above and below that of the subject. The below R code performs the sign test using some example data in c1.

c1 <- c(2,1,2,3,1,2,2,1,1,3,3,1)
sub <- c(1,1,1,1,1,1,1,1,1,1,1,2)
diffn <- c1[sub == 1]
diffp <- c1[sub == 2]
diff <- diffn - diffp 
a1 <- as.numeric(diff<0)
b1 <- as.numeric(diff>0)

More programs

Further types of analysis involving single cases may be performed using Single Modeling Analysis (Borckardt et al. 2008). The freeware for doing this and a User's Guide is here. An application of one of these methods (bootstrapped cross-correlations) is briefly described in Jarrett and Ollendick (2012).

Auerbach and Zeitlin (2014) describe their R package called SSD which performs a range of single subject analyses.

Marcum and Butts (2015) have R code and a pdf paper here for looking at repeated sequences of events e.g. re-offending over time.


Auerbach C and Zeitlin W (2014) SSD for R: An R Packages for analyzing single-subject data. Oxford University Press:Oxford. Overview of using the SSD freeware with R.

Borckardt JJ, Nash MR, Murphy MD, Moore M, Shaw D and O'Neil P (2008) Clinical practice as natural laboratory for psychotherapy research. American Psychologist 63 77-95. doi: 10.1037/0003=066X.63.2.77.

Crawford JR and Howell DC (1998) Comparing an individual's test score against norms derived from small samples. The Clinical Neuropsychologist 12 482-486.

Jarrett MA and Ollendick TH (2012) Treatment of comorbid attention-deficit/hyperactivity disorder and anxiety in children: a multiple baseline design analysis. Journal of Consulting and Clinical Psychology 80(2) 239-244.

Mycroft RH, Mitchell DC, & Kay J (2002). An evaluation of statistical procedures for comparing an individual's performance with that of a group of controls. Cognitive Neuropsychology, 19, 291-299.

None: FAQ/singcase (last edited 2017-04-04 15:57:39 by PeterWatson)