Jason Curole
2008-Aug-17 18:31 UTC
[R] Error fitting overdispersed logistic regression: package dispmod
Hi all, First, a quick thank you for R; it's amazing. I am trying to fit models for a count dataset following the overdispersed logisitic regression approach outlined in Baggerly et al. (BMC Bioinformatics, 5:144; Annotated R code is given at the end of the paper) but R is returning an error with the data below. Any help in understanding or overcoming this obstacle is appreciated.>library(dispmod) # required for dispersion fitting# Now the data>counts<-matrix(c(2,1,3,1,2715597,3296062,2945864,2215143), ncol=2) >temp<-c(25,20,25,20) # linear factor-Temperature >trtmnt<-c(0,0,1,1) #categorical factor#And the models>fit1<-glm(counts~temp+trtmnt, family="binomial") >fit2<-glm.binomial.disp(fit1)Binomial overdispersed logit model fitting... Iter. 1 phi: -3.615313e-07 Error in glm(formula = counts ~ temp + trtmnt, family = "binomial", weights = disp.weights) : negative weights not allowed> disp.weights[1] 54.865991 -5.218398 -15.379204 5.021180 So, clearly some dispersion weights are negative, which, according to my understanding of the model, would produce negative variances. Is there a way around this? Thanks, Jason