Constantinos Antoniou
2006-Jan-02 14:41 UTC
[R] mixed effects models - negative binomial family?
Hello all, I would like to fit a mixed effects model, but my response is of the negative binomial (or overdispersed poisson) family. The only (?) package that looks like it can do this is glmm.ADMB (but it cannot run on Mac OS X - please correct me if I am wrong!) [1] I think that glmmML {glmmML}, lmer {Matrix}, and glmmPQL {MASS} do not provide this "family" (i.e. nbinom, or overdispersed poisson). Is there any other package that offers this functionality? Thanking you in advance, Costas [1] Yes, I know I can use this on another OS. But it is kind of a nuisance, as I have my whole workflow setup on a mac, including emacs +ess, the data etc etc. It will be non-trivial to start moving/ syncing files between >1 computers, in order to use this package... -- Constantinos Antoniou, Ph.D. Department of Transportation Planning and Engineering National Technical University of Athens 5, Iroon Polytechniou str. GR-15773, Athens, Greece
Constantinos Antoniou <antoniou <at> central.ntua.gr> writes:> > Hello all, > > I would like to fit a mixed effects model, but my response is of the > negative binomial (or overdispersed poisson) family. The only (?) > package that looks like it can do this is glmm.ADMB (but it cannot > run on Mac OS X - please correct me if I am wrong!) [1] > > I think that glmmML {glmmML}, lmer {Matrix}, and glmmPQL {MASS} do > not provide this "family" (i.e. nbinom, or overdispersed poisson). Is > there any other package that offers this functionality?You'll probably get more complete/informed information shortly, but ... you may not be able to get a negative binomial distribution per se, but other versions of "overdispersed Poisson" are indeed possible. glmmPQL will let you use the quasipoisson family, which allows for overdispersion in a phenomenological way; more mechanistically, observation-level random effects on the scale of the linear predictor (log for a GLMM with family=poisson) lead to a lognormal-Poisson distribution, which has similar properties to the NB. I suspect you can do this in lmer (lme4 package), which does GLMMs if you specify the family argument. See: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=11393830&dopt=Abstract (analysis done in SAS but probably completely feasible in R at this point) Ben
Elizabeth Lawson
2006-Jan-03 21:54 UTC
[R] mixed effects models - negative binomial family?
Have you tried nlme? I tried to something similar. Here is the code that I used for a negative binomial random effects model library(nlme) mydata<-read.table("C:\\Plx\\plx.all\\plxall.txt",header=TRUE) loglike = function(PLX_NRX,PD4_42D,GAT_34D,VIS_42D,MSL_42D,SPE_ROL,XM2_DUM,THX_DUM,b0,b1,b2,b3,b4,b5,b6,b7,alpha){ lambda = exp(b0 + b1*GAT_34D+b2*VIS_42D+b3*MSL_42D+b4*PD4_42D+b5*SPE_ROL+b6*XM2_DUM+b7*THX_DUM) y=round(PLX_NRX) y <- table(y) freq <- as.vector(y) count <- as.numeric(names(y)) count <- count[!(freq < 1)] freq <- freq[!(freq < 1)] n <- length(count) df <- n - 1 df <- df - 2 xbar <- weighted.mean(count, freq) s2 <- var(rep(count, freq)) p <- xbar/s2 alpha <- xbar^2/(s2 - xbar) ( dnbinom(y,alpha,(alpha/(alpha+lambda))) ) } plx.nlme<-nlme(PLX_NRX~loglike(PLX_NRX,PD4_42D,GAT_34D,VIS_42D,MSL_42D,SPE_ROL,XM2_DUM,THX_DUM,b0,b1,b2,b3,b4,b5,b6,b7,alpha), data=mydata, fixed=list(b0 + b1+b2+b3+b4+b5+b6+b7+alpha~1), random=b0~1|menum, start=c(b0=0,b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0,alpha=5) ) I am not sure that this is what you are looking for , but I hope this helps! Elizabeth Lawson Constantinos Antoniou <antoniou@central.ntua.gr> wrote: Hello all, I would like to fit a mixed effects model, but my response is of the negative binomial (or overdispersed poisson) family. The only (?) package that looks like it can do this is glmm.ADMB (but it cannot run on Mac OS X - please correct me if I am wrong!) [1] I think that glmmML {glmmML}, lmer {Matrix}, and glmmPQL {MASS} do not provide this "family" (i.e. nbinom, or overdispersed poisson). Is there any other package that offers this functionality? Thanking you in advance, Costas [1] Yes, I know I can use this on another OS. But it is kind of a nuisance, as I have my whole workflow setup on a mac, including emacs +ess, the data etc etc. It will be non-trivial to start moving/ syncing files between >1 computers, in order to use this package... -- Constantinos Antoniou, Ph.D. Department of Transportation Planning and Engineering National Technical University of Athens 5, Iroon Polytechniou str. GR-15773, Athens, Greece ______________________________________________ R-help@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 --------------------------------- [[alternative HTML version deleted]]
Apparently Analagous Threads
- nlme Singularity in backsolve at level 0, block 1
- error loading Matrix in Mac OSX 10.4
- problem installing packages with compiled-from-source R.app on Mac OS X - Tiger
- vlmc - "In vlmc(traffic.clusters.stationary, cutoff = i) : alphabet with >1-letter strings; trying to abbreviate"
- Unbundling gregmisc (was: loading gap package)