[R] Pspline smoothing

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Nov 25 23:08:35 CET 2002


On Mon, 25 Nov 2002, Martin Renner wrote:

> 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

time <- 1:100
x <- rnorm(100)
traj.spl <- smooth.Pspline(time, x, norder=3 )

works for me.  It's probably something specific to your data.  However,
the defaults spar=0, method=1 are not sensible: they are asking for
a perfect fit. At least try method=3.

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

?smooth.Pspline does not have argument cv listed for smooth.Pspline,
so no wonder it does not work.

> 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

That's *length* 1, not value 1. It's also sm.spline not smooth.Pspline.

I suspect that if you read the help page accurately you can find ways
to do what you want.  I suggest starting with the defualt settings of
sm.spline until you understand those of smooth.Pspline.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list