Hi everybody,

I am trying to fit a GAM model without intercept using library mgcv. 
However, the result has nothing to do with the observed data. In fact 
the predicted points are far from the predicted points obtained from the 
model with intercept. For example:

#First I generate some simulated data:

library(mgcv)
x<-seq(0,10,length=100)
y<-x^2+rnorm(100)

#then I fit a gam model with and without intercept

m1<-gam(y~s(x,k=10,bs='cs'))
m2<-gam(y~s(x,k=10,bs='cs')-1)

#and now I obtain predicted values for the interval 0-1

x1<-seq(0,10,0.1)
y1<-predict(m1,newdata=list(x=x1))
y2<-predict(m2,newdata=list(x=x1))

#plotting predicted values

plot(x,y,ylim=c(0,100))
lines(x1,y1,lwd=4,col='red')
lines(x1,y2,lwd=4,col='blue')

In this example you can see that the red line are the predicted points 
from the model with intercept which fit pretty good to the data, but the 
blue line (without intercept) is far from the observed points.

Probably I missunderstanding some key elements in gam modelling or using 
incorrect syntaxis. I don't know what the problem is. Any ideas will be 
helpful.

Sergio







-- 
Sergio A. Estay
Inst. Ciencias Ambientales y Evolutivas
Universidad Austral de Chile
Casilla 567, Valdivia, Chile
Phone: 5663-293913
http://www.ciencias.uach.cl/instituto/ciencias_ambientales_evolutivas/academicos/sergio-estay.php






--
View this message in context: 
http://r.789695.n4.nabble.com/GAM-without-intercept-tp4645786.html
Sent from the R help mailing list archive at Nabble.com.
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to