[R] Specifying random effects distribution in glmer()

Robert A. LaBudde ral at lcfltd.com
Mon Aug 25 04:10:39 CEST 2008


I'm trying to figure out how to carry out a Poisson regression fit to 
longitudinal data with a gamma distribution with unknown shape and 
scale parameters.

I've tried the 'lmer4' package's glmer() function, which fits the 
Poisson regression using:

library('lme4')
fit5<- glmer(seizures ~ time + progabide + timeXprog + 
offset(lnPeriod) + (1|id),
   data=pdata, nAGQ=1, family=poisson) #note: can't use nAGQ>1, not 
yet implemented
summary(fit5)

Here 'seizures' is a count and 'id' is the subject number.

This fit works, but uses the Poisson distribution with the gamma heterogeneity.

Based on the example in the help for glmer(), I tried

fit6<- glmer(seizures ~ time + progabide + timeXprog + offset(lnPeriod) +
   (1|pgamma(id, shap, scal)), data=pdata, nAGQ=1, start=c(shap=1, scal=1),
   family=poisson) #note: can't use nAGQ>1, not yet implemented
summary(fit6)

but this ends up with "Error in pgamma(id, shap, scal) : object 
"shap" not found".

My questions are:

1. Can this be done?
2. Am I using the right package and function?
3. What am I doing wrong?

Any help would be appreciated.

Thanks.

================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"



More information about the R-help mailing list