R-users, Can an offset term be included in a Poisson model? I get an error message when trying that:>r3o <- glm(tax ~ areal + offset(o), family=poisson)Error in (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, : inner loop 1; can't correct step size In addition: Warning message: Step size truncated due to divergence in: (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, (this error message doesn't appear with family= gaussian) Juli ******************** Juli G. Pausas Centro de Estudios Ambientales del Mediterraneo (CEAM) C/ C.R. Darwin 14 Parc Tecnologic, 46980 Paterna, Valencia, SPAIN Tel: (+ 34) 96 131 8227 Fax: (+ 34) 96 131 8190 E-mail: juli at ceam.es http://www.gva.es/ceam -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> To: r-help at stat.math.ethz.ch > From: "Juli G. Pausas" <juli at ceam.es> > Subject: [R] glm: offset in poisson > Date: Thu, 16 Mar 0 12:52:49 +0000 (GMT) > X-Info: Mail Test Period > > R-users, > > Can an offset term be included in a Poisson model? > I get an error message when trying that: > > >r3o <- glm(tax ~ areal + offset(o), family=poisson) > Error in (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, : > inner loop 1; can't correct step size > In addition: Warning message: > Step size truncated due to divergence in: (if (is.empty.model(mt)) > glm.fit.null else glm.fit)(x = X, y = Y, > > (this error message doesn't appear with family= gaussian) >Certainly, but the offset is on the scale of the log mean for the Poisson, and the mean for the Gaussian, so I suspect you may have completely inappropriate values of the offset. Here's an example from the V&R3 on-line exercises (and answers): library(MASS) data(Insurance) glm(Claims ~ District*Group*Age - District:Group:Age + offset(log(Holders)), data=Insurance, family=poisson) -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"Juli G. Pausas" <juli at ceam.es> writes:> R-users, > > Can an offset term be included in a Poisson model? > I get an error message when trying that: > > >r3o <- glm(tax ~ areal + offset(o), family=poisson) > Error in (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, : > inner loop 1; can't correct step sizeWhich version of R is that? I have no trouble with simple things like> x1 <- rnorm(10) > x2 <- rnorm(10) > y <- rpois(10, exp(x1+x2)) > glm(y~x1+offset(x2),family=poisson)Call: glm(formula = y ~ x1 + offset(x2), family = poisson) Coefficients: (Intercept) x1 0.0548 0.6574 Degrees of Freedom: 9 Total (i.e. Null); 8 Residual Null Deviance: 9.823 Residual Deviance: 4.018 AIC: 34.03 You're aware that the offset needs to be on the link scale? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._