Hi,
I have binary (0,1) data for a trait as my response variable, and
a dependent variable, genotype, with three classes (AA, AB, BB).

I would like to plot this data so that across the three genoytpes, even
though the points are all either 0 or 1, i want them to stack up or be seen
using 'jitter'.  So far I have been able to do this using xyplot {lattice}
(code below) but could not get the points to jitter or stack up on boxplot
or bwplot {lattice}.

 I would also like to add to the xyplot object, the mean of the values at
each of these classes  which will vary depending on how many data points are
at 0 and 1 for a given genotype.  I would also like to put error (i.e.
standard error) bars around these estimates.

I have tried using the points() function to put the mean at each of the
genotype classes, but the point ends up off the figure. Any ideas how to get
this going?

here is some example code.

> gtype<-c("AA","AB","BB")
x<-sample(gtype,20,replace=TRUE)
y<-sample(c(0,1),20,replace=TRUE)
bin.data<-data.frame(x,y)
xyplot(y~x, jitter.y=TRUE, jitter.x=TRUE,factor=.6, data=bin.data)

Then If I wanted to add the means to the plot, I would do this, which will
print the mean points on a box plot, but not an xyplot:

means1 <- tapply(bin.data$y,bin.data$x,mean)
points(means1,col="red",pch=18)

Is there a way to get the means, and even error bars on the same xyplot?

Thanks for any help in advance,
Louis

	[[alternative HTML version deleted]]

