[R] glmmBUGS: logistic regression on proportional data

Dieter Menne dieter.menne at menne-biomed.de
Sun Feb 8 16:46:24 CET 2009


John Poulsen <jpoulsen <at> zoo.ufl.edu> writes:

> I am trying to run a logistic regression with random effects on 
> proportional data in glmmBUGS.  I am a newcomer to this package, and 
> wondered if anyone could help me specify the model correctly. 
> 
> I am trying to specify the response variable, /yseed/, as # of successes 
> out of total observations... but I suspect that given the error below, 
> that is not correct.  Also, Newsect should be a factor, whereas Newdist 
> is continuous.
> 
> Thanks,
> John
> 
> Newdat<-data.frame(Newtree=rep(1:3, each=20), Newsect=rep(c("a","b"), 
> each=10), Newdist=rep(1:5, 2),
>                    y=rpois(60,2), tot=rep(c(14,12,10,8,6), 12))
> 
> yseed<-cbind(Newdat$y, Newdat$tot)
> 
> mod<-glmmBUGS(yseed~Newsect + Newdist, effects="Newtree", 
> family="binomial", data=Newdat)
> 

First, a typo, there is no yseed. Second, after the error message
"must be between 0 and 1", this looks more like poisson, because
you have the counts, not the events. 

This might come close

mod<-glmmBUGS(y~Newsect + Newdist, effects="Newtree", 
  family="poisson", data=Newdat)


Dieter




More information about the R-help mailing list