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 ? Best wishes Troels Ring, Aalborg -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
A log-linear fit with offset and linear predictor that reflects the Poisson hypothesis does it: > glm(years~offset(log(sum(years))-lgamma(deaths+1))+deaths,family=poisson) ... Coefficients: (Intercept) deaths -0.6100 -0.4943 Degrees of Freedom: 6 Total (i.e. Null); 5 Residual Null Deviance: 36.23 Residual Deviance: 0.8668 AIC: 27.34 ... Note that the intercept estimates mu directly whereas the slope does this indirectly: exp(-0.4943) = 0.6099978. More details can be found in J.K. Lindsey: "Applying Generalized Linear Models", Springer, 1997, ch. 3. G?ran Arnoldsson Deapartment of statistics Ume? University Sweden -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._