I am fitting a Poisson glm model, say
r<-glm(O~ns(log(size),3)+x1+x2,data=indata,family=poisson)
I understand that the predict.glm() function is unreliable and the
document says it is
safer to use predict.gam() since a data dependent transformation is used.
However, I have not been able to make it work. As a simple test,
if I pick a given row form the input dataset and call it "newdata".
If I run
predict.gam(r, type="response", newdata)
I expect to get the r$fitted.values for the corresponding row in indata.
I am getting answers that are far far away from what I expect.
Did I miss anything important? Is there anyway to make it work correctly
or reliably?
Ping Zhang
Avaya labs
|