Dear R friends.
I´m trying to fit a Logistic Regression using glm( family='binomial').
Here is the model:
*model<-glm(f_ocur~altitud+UTM_X+UTM_Y+j_sin+j_cos+temp_res+pp,
offset=(log(1/off)), data=mydata, family='binomial')*
mydata has 76820 observations.
The response variable f_ocur) is a 0-1.
This data is a SAMPLE of a bigger dataset, so the idea of setting the
offset is to account that the data used here represents a sample of the
real data to be analyzed.
For some reason the offset is not working. When I run this model I get a
result, but when I run the same model but without the offset I get the
exact result than the previous model I was expecting a different result but
no... there is no difference.
Am I doing something wrong? Should the offset be with the linear
predictors? like this:
*model<-glm(f_ocur~altitud+UTM_X+UTM_Y+j_sin+j_cos+temp_res+pp+**
offset(log(1/off))**, data=mydata, family='binomial')*
Once the model is ready, I´d like to use it in a new data. The new data
would be the data to validate this model, this data has de the same
columns, my idea is to use:
*validate<-predict(model, newdata=data2, type='response')*
And here comes my question, does the predict function takes into
consideration the *offset *used to create the model? if not, what should I
do in order to get the correct probabilities in the new data?
I´d really appreciate if anyone could help me.
Thank you.
Lucas.
[[alternative HTML version deleted]]