[R] Specifying random effects distribution in glmer()
Simon Blomberg
s.blomberg1 at uq.edu.au
Mon Aug 25 05:02:38 CEST 2008
Are you trying to fit a Poisson GLMM with Gamma random effects? I don't
think you can do that using (g)lmer, which assumes a Gaussian
distribution for the random effects. You might have a look at the hnlmix
function in Jim Lindsey's repeated package. Or you could use Bayesian
methods in JAGS, BUGS etc. Usually Gamma random effects are multipliers,
not additive. So it makes sense to set the mean =1, unlike Gaussian
random effects with mean=0. This will place a restriction on the shape
and scale parameters.
HTH,
Simon.
On Sun, 2008-08-24 at 22:10 -0400, Robert A. LaBudde wrote:
> 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"
>
> ______________________________________________
> R-help at r-project.org 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.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat.
Lecturer and Consultant Statistician
Faculty of Biological and Chemical Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au
Policies:
1. I will NOT analyse your data for you.
2. Your deadline is your problem.
The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer can
be extracted from a given body of data. - John Tukey.
More information about the R-help
mailing list