[R] scatterplot smoothing using gam
Tony Long
tdlong at uci.edu
Thu Jul 24 21:06:21 CEST 2003
All:
I am trying to use gam in a scatterplot smoothing problem.
The data being smoothed have greater 1000 observation and have
multiple "humps". I can smooth the data fine using a function
something like:
out <- ksmooth(x,y,"normal",bandwidth=0.25)
plot(x,out$y,type="l")
The problem is when I try to fit the same data using gam
out <- predict.gam(gam(y~s(x)),se=TRUE)
plot(x,out$fit,type="l")
I only seem to get fits that would correspond to "big" bandwidths
using ksmooth, and straight lines are always fit to the data. I do
not appear to appreciate how to "control bandwidth" using gam. As
even if I apply something like the gam model above to the smoothed
"out$y" generated using ksmooth it tends to flatten out the smoothing
curve.
--
###########################
Tony Long
Ecology and Evolutionary Biology
Steinhaus Hall
University of California at Irvine
Irvine, CA
92697-2525
Tel: (949) 824-2562 (office)
Tel: (949) 824-5994 (lab)
Fax: (949) 824-2181
email: tdlong at uci.edu
http://hjmuller.bio.uci.edu/~labhome/
More information about the R-help
mailing list