[R] negative binomial lmer
ronggui
ronggui.huang at gmail.com
Fri Jul 28 10:41:22 CEST 2006
I think you should use glmm.admb.
>library(glmmADMB)
>?glmm.admb
glmm.admb package:glmmADMB R Documentation
Generalized Linear Mixed Models using AD Model Builder
Description:
Fits mixed-effects models to count data using Binomial, Poisson or
negative binomial response distributions. Zero-inflated versions
of Poisson and negative binomial distributions are available.
2006/7/28, Tracy Feldman <tracysfeldman at yahoo.com>:
> To whom it may concern:
>
> I have a question about how to appropriately conduct an lmer analysis for negative binomially distributed data. I am using R 2.2.1 on a windows machine.
>
> I am trying to conduct an analysis using lmer (for non-normally distributed data and both random and fixed effects) for negative binomially distributed data. To do this, I have been using maximum likelihood, comparing the full model to reduced models (containing all but one effect, for all effects). However, for negative binomially distributed data, I need to estimate the parameter theta. I have been doing this by using a negative binomial glm of the same model (except that all the effects are fixed), and estimating mu as the fitted model like so:
>
> model_1 <-glm.nb(y~x1+x2+x3, data = datafilename)
> mu_1 <- fitted(model_1)
> theta_1 <- theta.ml(y, mu_1, length(data), limit = 10, eps = .Machine$double.eps^0.25, trace = FALSE)
>
> Then, I conduct the lmer, using the estimated theta:
>
> model_11 <-lmer(y~x1+x2+(1|x3), family = negative.binomial(theta = theta_1, link = "log"), method = "Laplace")
>
> First, I wondered if this sounds like a reasonable method to accomplish my goals.
>
> Second, I wondered if the theta I use for reduced models (nested within model_11) should be estimated using a glm.nb with the same combination of variables. For example, should a glm.nb with x1 and x3 only be used to estimate theta for an lmer using x1 and x3?
>
> Third, I wish to test for random effects of one categorical variable with 122 categories (effects of individual). For this variable, the glm.nb (for estimating theta) does not work--it gives this error message:
> Error in get(ctr, mode = "function", envir = parent.frame())(levels(x), :
> orthogonal polynomials cannot be represented accurately enough for 122 degrees of freedom
> Is there any way that will allow me to accurately estimate theta using this particular variable (or without it)? Or should I be using a Poisson distribution (lognormal?) instead, given these difficulties?
>
> If anyone has advice on how to properly conduct this test (or any references that might tell me in a clear way), I would be very grateful. Also, please let me know if I should provide additional information to make my question clearer.
>
> Please respond to me directly, as I am not subscribed to this list.
>
> Thank you very much,
>
> Tracy S. Feldman
>
> Postdoctoral Associate, the Noble Foundation, Ardmore, OK.
>
> __________________________________________________
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
--
»ÆÈÙ¹ó
Department of Sociology
Fudan University
More information about the R-help
mailing list