On Mon, 2 Feb 2009, antonio.gasparr...@lshtm.ac.uk wrote:

Dear all,

I have a very basic question:
how does the logLik function work for poisson models?

You mean its inner workings or just what is the computation?

The computation is just the vanilla loglikelihood:

        sum( dpois( y, mean(y), log=TRUE) )

for your Poisson model.

See
        ?dpois

And for the inner workings, see

        stats:::logLik.glm

        poisson()$aic

---

More generally, read the article

        Ligges, U. (2006): R Help Desk: Accessing the Sources. R News 6
        (4), 43-45. http://cran.r-project.org/doc/Rnews/

HTH,

Chuck


Example:
I simulate 20 observations from a Poisson distribution with mean 800.

y <- rpois(20,800)
model <- glm(y ~ 1, family=poisson())
logLik(model)

I would like to know what's the exact formula the function logLik uses.
I looked at ?extractAIC but I cannot sort it out.

Can you please give me an help?
Thanks a lot

Antonio Gasparrini
Public and Environmental Health Research Unit (PEHRU)
London School of Hygiene & Tropical Medicine
Keppel Street, London WC1E 7HT, UK
Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523
Skype contact: a.gasparrini
http://www.lshtm.ac.uk/people/gasparrini.antonio ( 
http://www.lshtm.ac.uk/pehru/ )

______________________________________________
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.


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