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
Please try again after upgrading to the versions of R and MASS. If you still have a problem, PLEASE do read the posting guide! "R-project.org/posting-guide.html" before you submit another post. Most of the people who donate their time to answer questions on this listserve are more likely to answer a question if it is simple and completely self contained -- including a very brief toy example that they can copy from an email into R and reproduce the problem. If they can't do that, they are less likely to understand your question and therefore less likely to produce a useful answer -- and less likely to bother to even read carefully your question. hope this helps, spencer graves rsubcriber wrote:> 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 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! R-project.org/posting-guide.html