[R] panel-dependent distribution in qqmath
Benjamin Tyner
btyner at gmail.com
Wed Oct 11 21:50:12 CEST 2006
In qqmath, how would one go about having 'distribution' change with
panel.number? I've tried
set.seed(1)
mydata <- data.frame(ind = factor(rep(2:4, each = 100)))
mydata$val <- rt(300, df=rep(2:4, each = 100))
plot<-qqmath(~ val | ind,
layout=c(3,1),
data = mydata,
prepanel = function(x, distribution, ...) {
mydist<-function(p) qt(p, df = panel.number() + 1)
prepanel.qqmathline(x, distribution=mydist,...)
},
panel = function(x, distribution, ...) {
mydist<-function(p) qt(p, df = panel.number() + 1)
panel.qqmathline(x, distribution=mydist,...)
panel.qqmath(x, distribution=mydist,...)
})
But no luck.
Ben
More information about the R-help
mailing list