[R] L'abbe plot

Jim Lemon jim at bitwrit.com.au
Sun May 15 06:55:53 CEST 2011


On 05/14/2011 07:20 AM, Whitney.Melroy at colorado.edu wrote:
> I cannot seem to get a L'abbe plot to work on R. I do not understand what
> the X coordinates, or alternatively an object of class metabin, is
> supposed to mean. What is a class of metabin?
>
Hi Whitney,
The L'Abbe plot is a relatively simple illustration that shows the 
results of intervention trials as two proportions on a Cartesian plane. 
The outcomes must be dichotomous (dead/alive, cured/not cured, 
improved/not improved, etc.) and the comparisons are between two 
interventions. Say that I was asked to evaluate an intervention for 
excessive drinkers that randomly assigned the subjects to either a 
session with a behavioral therapist or a session of equal duration with 
an ex-drinker. The outcome might be whether the subject drank more or 
less over the succeeding month. Thus:

didf<-data.frame(subject=1:50,interv=rep(c("therapist","ex-drinker"),each=25),outcome=sample(c("more","less"),50,TRUE))

didf.tab<-table(didf$interv,didf$outcome)
didf.tab

              less more
   ex-drinker   14   11
   therapist    12   13
chisq.test(didf.tab)

         Pearson's Chi-squared test with Yates' continuity correction

data:  didf.tab
X-squared = 0.0801, df = 1, p-value = 0.7771

Apparently ex-drinkers are no better or worse than therapists. So we 
want to illustrate this with a L'Abbe plot.

library(plotrix)

labbePlot<-function(x,main="L'Abbe plot",
  xlab="Positive response with placebo (%)",
  ylab="Positive response with treatment (%)",...) {

  plot(0,xlim=c(0,100),ylim=c(0,100),main=main,xlab=xlab,
   ylab=ylab,type="n",...)
  for(trial in 1:length(x)) {
   sum_treat<-sum(x[[trial]][1,])
   sum_interv<-sum(x[[trial]][2,])
   xpos<-100*x[[trial]][1,1]/sum_treat
   ypos<-100*x[[trial]][2,1]/sum_interv
   rad<-sqrt(sum_treat+sum_interv)/2
   draw.circle(xpos,ypos,rad)
  }
  segments(0,0,100,100)
}

x<-list(didf.tab)
labbePlot(x)

This shows that the therapists, whom we expected to do better, were 
slightly, but not significantly, worse than the ex-drinkers. This can't 
be right, so let's follow it up with a bigger trial.

didf2<-data.frame(subject=1:200,
  interv=rep(c("therapist","ex-drinker"),each=100),
  outcome=c(sample(c("more","less"),100,TRUE,prob=c(0.3,0.7)),
  sample(c("more","less"),100,TRUE,prob=c(0.7,0.3))))

didf2.tab<-table(didf2$interv,didf2$outcome)
x<-list(didf.tab,didf2.tab)
labbePlot(x)

That's better, isn't it? This basic plot can be tarted up with colors 
for the different circles, and other decorations so beloved of those who 
use presentation packages. Now that I've written it, I might as well add 
it to the plotrix package.

Jim



More information about the R-help mailing list