Wednesday, May 26, 2010

New project at BCL

Ted, Masha, and Haky will write a book titled

The statistics of crappy data.

Any suggestions or comments are welcome.

Tuesday, May 25, 2010

Order from here and help Agassiz




Sorry for the ad but...
If you buy through this link, Amazon will pay Friends of Agassiz 4 to 15% of the total purchase made within 24 hours. It doesn't cost you anything and you'll be helping a public school.

Thanks
Haky

Friday, May 14, 2010

boxplot with data points jittered


## CAN BE REPLACED BY qplot in ggplot2 package


qplot(x,y,geom=c("boxplot","jitter"))






## R function that plots boxplot and adds data points (jittered horizontally) 

## it can be improved so that it can take a model formula as argument
## like boxplot does
boxjitter =
function(x,y=NULL,border='gray',jitter=.1,vertical=T,...)
{
  if(!is.null(y))
  {
    boxplot(y~x,border=border,ylim = range(y,na.rm=T),outline=F,...)
    stripchart(y~x,vertical=vertical,method="jitter",jitter=jitter,add=T)
    meanvec = tapply(y,x,mean.na)
    points(1:length(meanvec),meanvec,pch="M",col='blue')
  } else
  {
    x = x[!is.na(x)]
    boxplot(x,border=border,ylim = range(x),outline=F,...)
    stripchart(x,vertical=vertical,method="jitter",jitter=jitter,add=T)
    points(1,mean.na(x),pch="M",col='blue')
  }
}

Subscribe via email

Enter your email address:

Delivered by FeedBurner

Followers

google analytics