On Dec 20, 2010, at 8:33 AM, Matthew Vernon wrote:

Matthew Vernon <m.c.ver...@warwick.ac.uk> writes:

Is it possible to produce box-and-whisker plots given that I have the
median, interquartile and 5/95th centile values, but not the data from
which they come?

Please note that the whiskers of the default BWP are NOT at the 5th and 95th percentiles although I would have guessed that they were too before I looked a closely at the code and the help pages. They are at the most extreme data points which do not exceed 1.5 times the box values which in turn are at "versions of the first and third quartiles".

(So , no, you cannot get what boxplot would have given unless you have the IQR values and all of the data outside those values. You can, of course, make up your own approach and use the boxplot machinery for plotting .... as long as you inform your audience what you are plotting.)



The answer, which came from Steve Ellison (thanks!) is to note that
"stats" is the only bit of the "z" argument to bxp that has to be
present, so given a data file with columns year,mean,median,centiles,
something like this works:

# transform data so the rows are the various centiles in order
# there's probably a more elegant approach!
bsr <- matrix(allobs[,c(4,5,3,6,7)],nrow=5,byrow=TRUE)
# column 1 is the year, which is our factor
bsbox <- list( stats=bsr,names=allobs$V1)
bxp(bsbox,xlab="Year",ylab="Number of cattle per batch")

I thought I'd follow-up so the answer to my question will be in the
archives.

Thanks,

Matthew


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to