[R] predict.glmmPQL Problem
rsubcriber
rsubscriber at slcmsr.net
Fri Mar 24 18:08:00 CET 2006
Dear all,
for a cross-validation I have to use predict.glmmPQL() , where the
formula of
the corresponding glmmPQL call is not given explicitly, but constructed
using as.formula.
However, this does not work as expected:
x1<-rnorm(100); x2<-rbinom(100,3,0.5); y<-rpois(100,2)
mydata<-data.frame(x1,x2,y)
library(MASS)
# works as expected
model1<-glmmPQL(y~x1, ~1 | factor(x2), family=poisson, data=mydata)
predict(model1, newdata=mydata, type="response")
f<-as.formula(paste("y", "~","x1"))
# predict does not work:
# Error in mCall[["fixed"]][-2] : object is not subsettable
model2<-glmmPQL(f, ~1 | factor(x2), family=poisson, data=mydata)
predict(model2, newdata=mydata, type="response")
Has anyone an idea what goes wrong?
I am using R 2.0.1 under Windows 2000.
Thanks,
Anneke
More information about the R-help
mailing list