Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

Assume the following easy example of a glm regression with an offset:

numberofdrugs<-rpois(84, 10)
healthvalue<-rpois(84,75)
age<-rnorm(84,50,5)
test<-glm(healthvalue~age, family=poisson, offset=log(numberofdrugs))
summary(test)
fitted(test) #how to get one of these values manually?
  • How can I compute the fitted values manually?
  • Also, why is there no estimation of log(numberofdrugs)?
    • In the book Generalized Linear Models on page 205-207 there is an example where the offset is estimated. It was done to see if the coefficient is close to one. It's 0.903 (see page 207 if you've this classic book) and from this follows, that there is nearly a constant rate in the number of damage incident!

Previous related questions asked:

share|improve this question
Please use code (four-spaces indent, {} button) instead of cite (> indent, " button). – mbq Jun 8 '11 at 10:48

2 Answers

About the practical part -- outputs of glm or summary are just lists which are pretty-printed for user convenience. You can see their full structure calling unclass on them and extract single values as usual, with a help of $, [[]] and [] operators.

share|improve this answer

There should not be an estimate of the offset: this offset is (could be) different for every observation (the whole idea is that you monitor the number of events within a (linear) 'timemeasure' (here apparently numberofdrugs).

There is no one 'population' offset you could estimate: person 1 is going to have 5 drugs administered, person 2 maybe 10, and you assume that the number of events (healthvalue?) is linear with this person's numberofdrugs (as per the answer to your previous question).

I don't have the book at hand, and Amazon won't let me look at the pages you mention, but I suppose something else is happening there (maybe simply the average numberofdrugs in the population)?

share|improve this answer
Ok that makes sense to me, but how are the fitted values calculated? – MarkDollar Jun 8 '11 at 12:54
Once you have the beta_0 and beta_1 from the model, then for any observation, given its age and numberofdrugs, you calculate beta_0+beta_1*age+log(numberofdrugs). You can see the offset as simply another variable for which you fix the coefficient (well, of its logtransform) to 1 in the Poisson regression. – Nick Sabbe Jun 8 '11 at 13:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.