1
votes

I fitted a rate model using glm() (poisson link with offset, like

y ~ offset(log(x1)) + x2 + x3

the response is y/x1 in this case).

Then I wanted to do cross validation using caret package so I used 'train()' function with k-fold CV control. It turns out the 2 models I have are very different. It seems that train() can't handle offset: I change the variable within offset to be offset(log(log(x1)) or offset(log(sqrt(x1)), the models remain the same.

Any one have this kind of experience before and how did you deal with it? Thanks!

btw I want to save the prediction on each validation set so so far I only know caret can do that, thats why I didnt choose to use cv.glm.

1

1 Answers

0
votes

I cannot claim to have prior experience with this exact process, and have not done any testing in the absence of you offering a reproducible example and code. But I do have experience with moving offsets to the LHS of a glm-Poission regression call, so why not change the formula (and family) to:

 glm( I(y/x1) ~ x2 + x3, family=quasipoisson, data= , ...)