[R] Pspline smoothing
snw at mcs.st-and.ac.uk
Tue Nov 26 13:47:18 CET 2002
The mgcv and gss packages will both let you fit higher order splines
(penalized regression splines in mgcv and full splines in gss). In mgcv
it's something like:
time <- 1:100
x <- rnorm(100)
gam(x~s(time,m=3)) # default basis dimension 10 p.r. spl.
gam(x~s(time,m=3,k=100)) # use full smoothing spl.
(the latter is not a good idea if number of data is large!)
> Simon Wood snw at st-and.ac.uk http://www.ruwpa.st-and.ac.uk/simon.html
> CREEM, The Observatory, Buchanan Gardens, St Andrews, Fife KY16 9LZ UK
> Direct telephone: (0)1334 461844 Indirect fax: (0)1334 463748
> Dear all,
> I'm trying to use the Pspline add-on package to fit a quintic spline
> (norder =3), but I keep running into a Singularity error.
> > traj.spl <- smooth.Pspline(time, x, norder=3 )
> Error in smooth.Pspline(time, x, norder = 3) :
> Singularity error in solving equations
> Playing around with the other parameters produces an "unused arguments" error:
> > traj.spl <- smooth.Pspline(time, x, norder=3 , cv=FALSE, method=3)
> Error in smooth.Pspline(time, x, norder = 3, cv = FALSE, method = 3) :
> unused argument(s) (cv ...)
> Setting norder=2 doesn't produce an error but summary indicates norder=1.
> > traj.spl <- sm.spline (time,x, norder=2, cv=FALSE)
> > summary (traj.spl)
> Length Class Mode
> norder 1 -none- numeric
> x 36 -none- numeric
> ysmth 36 -none- numeric
> lev 36 -none- numeric
> gcv 1 -none- numeric
> cv 1 -none- numeric
> df 1 -none- numeric
> spar 1 -none- numeric
> call 6 -none- call
> Has anybody been able to fit quintic splines with Pspline or has some
> advise how to avoid the Singularity error?
> Thank you,
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help