On Friday 05 October 2007 16:25, Michela Leone wrote: > I'm fitting a Poisson gam model, say > > model<-gam(a65tm~as.factor(day.week > )+as.factor(week)+offset(log(pop65))+s(time,k=10,bs="cr",fx=FALSE,by=NA,m=1 >),sp=c( 0.001),data=dati1,family=poisson) > > > > Currently I've difficulties in obtaining right predictions by using > gam.predict function with MGCV package in R version 2.2.1 (see below my > syntax). --- What mgcv version is it?
> > previ<-predict.gam(model,dati2,type="response") --- is this supposed to be `dati2' or `dati1'? It's hard to understand the following comment if the data frame is different in fitting and prediction... > > I expect to get the predicted values in the same scale of the response > variable but they are far what I expect. (i.e 1.3 when my response variable > is 40), while when I use predict.gam with gam package I have right > prediction (in the response scale). > > Does anybody know if I missed anything important? Is there anyway to make > it work correctly or reliably? > --- It works on my test examples and no one has reported a problem until now. A quick fit of your model structure to simulated data also produces nothing unusual. Could you perhaps try again with the current mgcv version? (Not that there is anything in the changeLog likely to make a difference.) If there is still a problem would you be able to send me data and model fitting code showing the problem, and I'll look into it (data confidential, of course)? > Moreover, if it's possible, could anybody explain me why using gam function > with GAM package I obtain different predictions from those obtained using > gam function with MGCV package? > --- They'll always be somewhat different as the representation of the models is slightly different in gam::gam and mgcv::gam. See ?gam best, Simon -- > Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK > +44 1225 386603 www.maths.bath.ac.uk/~sw283 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.