All,

On p.52 of Deepayan Sarkar's Lattice book there is a nice plot of showing
residuals with median lines superimposed or various groups:

library("lattice")
stripplot(sqrt(abs(residuals(lm(yield~variety+year+site)))) ~ site, 

data = barley, groups = year, jitter.data = TRUE, type = c("p", "a"), fun =
median)


Suppose we wanted to make a similar plot for a numeric x-axis.  Is there any
way to do this with stripplot or does one have to xyplot and presumably
panel functionality to get the median line?  This does not work:

barley$site.numeric =as.numeric(barley$site)

stripplot(sqrt(abs(residuals(lm(yield~variety+year+site)))) ~ site.numeric,
    data = barley, groups = year, jitter.data = TRUE, type = c("p", "a"),
fun = median)


Any tips much appreciated.  For my data I had made my x-axis a factor but
forgot that this doesn't work since the intervals are not equally spaced.

Thanks!
David

______________________________________________
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