On Fri, 26 Mar 2010, Robert Ruser wrote:

2010/3/26 Charles C. Berry <cbe...@tajo.ucsd.edu>:
On Fri, 26 Mar 2010, Robert Ruser wrote:
So this is the generalized linear model with a poisson family, log link, and
a Gaussian random effect in the linear predictor.

Take a look at lme4, MASS (glmmPQL), and try searching CRAN packages for
'glm' and 'GLM' (there are a bunch and several promise to handle random
effects, but YMMV).

Thank you. But I'm wondering how to set random effect? I have the data
'my.data':
#n  number   count
1        0         252
2        1         163
3        2         120
4        3         95
............................

number | exp(lambda) ~poisson(exp(lambda))
exp(lambda)  ~  normal(a,b)

probably I should use a formula:

model.est <- glmer(number ~ 1, family = poisson(link="log"), data = my.data)

but how to set random effect? I do not have predictors. Second I need
to remember that for example 0 occurred 252 times. How to do it - I
can do it using number = seq(number,times=count), but calculation will
last longer.

So you have no clusters with more than one observation??

In that case glmer will complain and quit.

But what makes you think the extra-Poisson variation is indeed log-Normal??

If you accept that the extra-Poisson variation follows the Gamma distribution you can use MASS:::glm.nb. On the data you showed it runs 'instantly' using

y2 <- rep(0:3,c(252,163,120,95))
grp2 <- factor(1:length(y2))
fit2 <- glm.nb(y2~1/grp2)

and it fits a two parameter distribution, which is BTW is asymptotically log-normal (but I make no claim that those asymptotics apply here).

If you really need Poisson-logNormal, write a function that gives the probabilities of 0,...,k with k big enough to have vanishing probability for given (a,b) then minimize the difference between those values and the observed proportions using the Kullback-Liebler distance or the Pearson Chi-square w.r.t. (a,b).

HTH,

Chuck


I would appreciate any help.
Robert


Charles C. Berry                            (858) 534-2098
                                            Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu               UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

______________________________________________
R-help@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.

Reply via email to