[R] predict.glmmPQL Problem
Simon Blomberg
Simon.Blomberg at anu.edu.au
Thu Mar 30 06:07:14 CEST 2006
I have found a similar problem when constructing formulae and passing
them to glmmPQL. My solution was to use do.call(glmmPQL,...). See ?do.call.
HTH,
Simon.
pencer Graves wrote:
> Please try again after upgrading to the versions of R and MASS.
>
> If you still have a problem, PLEASE do read the posting guide!
> "www.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
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
--
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Centre for Resource and Environmental Studies
The Australian National University
Canberra ACT 0200
Australia
T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
F: +61 2 6125 0757
CRICOS Provider # 00120C
More information about the R-help
mailing list