9
$\begingroup$

I know this is probably a basic question... But I don't seem to find the answer.

I'm fitting a GLM with a Poisson family, and then tried to get a look at the predictions, however the offset does seem to be taken into consideration:

model_glm=glm(cases~rhs(data$year,2003)+lhs(data$year,2003),
offset=(log(population)), data=data, subset=28:36, family=poisson())

predict (model_glm, type="response")

I get cases not rates...

I've tried also

model_glm=glm(cases~rhs(data$year,2003)+lhs(data$year,2003)+
offset(log(population)), data=data, subset=28:36, family=poisson())

with the same results. However when I predict from GAM, using mgcv, the predictions consider the offset (I get rates).

I'm missing something?

$\endgroup$
  • 1
    $\begingroup$ Please don't cross-post here and on the r-help lists ... and if you were going to post on a stackoverflow/stackexchange forum, I think SO would be better (this is a technical R question, not a stats question ...) $\endgroup$ – Ben Bolker Apr 14 '12 at 16:23
12
$\begingroup$

It is correct you to get cases instead of rates since you are predicting cases. If you want to obtain the rates you should use the predict method on a new data set having all columns equal to data but the population column identically equal to 1, so to have log(populaton)=0. In this case you will get the number of cases of one unit of population, i.e. the rate.

$\endgroup$
  • 1
    $\begingroup$ Thanks for answering me. I don't find it odd for it to predict cases, I just thought I was missing something in order to set the prediction for rates (cases/population). Since in GAM's I didn't had to add anything else for it to predict (cases/population). $\endgroup$ – Sandra Apr 14 '12 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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