[R] horsekicks

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sat Nov 24 09:57:40 CET 2001


On Sat, 24 Nov 2001, Troels Ring wrote:

> Dear friends. I have these well known data on horsekicks:
> years <- c(109,  65,  22,   3 ,  1,   0)
> deaths <- 0:5
> and get a nice but wrong fit from
> summary(z1 <- glm(years~deaths,family=poisson))
> Can I take away the intercept ?

Yes, by

glm(years ~ deaths-1, family=poisson)

or

glm(years ~ 0+deaths, family=poisson)

*but* it would be nonsense.  That's a log-linear model with mean forced to
be one at 0 deaths!

My (decades old) memory of that dataset is that the numbers are observed
frequencies for years with Y occurrences, so the correct model is

glm(deaths ~ 1, family=poisson, weights = years)

This fits a Poisson with mean 0.6099978 = exp(-0.4943) with fitted values

> round(dpois(0:5, 0.6099978)*sum(years), 2)
[1] 108.67  66.29  20.22   4.11   0.63   0.08

a rather good match.  But, the estimate of the mean is the mean of the
observations:

> weighted.mean(deaths, years)
[1] 0.61

so you don't need glm to do this.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list