Thread Subject: Implementing smoothing splines

Subject: Implementing smoothing splines

From: Arvind Iyer

Date: 19 Nov, 2008 03:49:02

Message: 1 of 5

I need to fit smoothing splines to very noisy data.

I do not have the Spline Toolbox (whose 'spaps' function is recommended for such problems.)

How can smoothing splines be implemented with other MATLAB functions? The ordinary 'spline' function simply 'joins the dots' and does not perform smoothing.

What other inbuilt function can serve a similar purpose? Are there functions which perform generalized regression without the need to specify a functional form of regression function?

Subject: Implementing smoothing splines

From: Doug Schwarz

Date: 19 Nov, 2008 04:45:47

Message: 2 of 5

In article <gg02be$av0$1@fred.mathworks.com>,
 "Arvind Iyer" <aiyer@ict.usc.edu> wrote:

> I need to fit smoothing splines to very noisy data.
>
> I do not have the Spline Toolbox (whose 'spaps' function is recommended for
> such problems.)
>
> How can smoothing splines be implemented with other MATLAB functions? The
> ordinary 'spline' function simply 'joins the dots' and does not perform
> smoothing.
>
> What other inbuilt function can serve a similar purpose? Are there functions
> which perform generalized regression without the need to specify a functional
> form of regression function?


Perhaps spfit from the FEX would be useful.

<http://www.mathworks.com/matlabcentral/fileexchange/13812>


You might find a general purpose smoothing routine helpful, also.

<http://www.mathworks.com/matlabcentral/fileexchange/17986>

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Subject: Implementing smoothing splines

From: Arvind Iyer

Date: 20 Nov, 2008 16:38:01

Message: 3 of 5

Thank you that helped.

I had a couple of follow-up questions.

You've suggested spfit and supersmoother...When is one preferred over the other? (I have data with noise of very high variance.)

Also, can the user somehow modify the number of 'pieces' in the spline fit? I ask this because, for my data, the outputs of spfit look way too much like straight lines. Is this something one lives with (I haven't used splines before) or should we alter the options to get 'curvier' splines?

Doug Schwarz <see@sig.for.address.edu> wrote in message <see-B34D00.23454718112008@news.frontiernet.net>...
> In article <gg02be$av0$1@fred.mathworks.com>,
> "Arvind Iyer" <aiyer@ict.usc.edu> wrote:
>
> > I need to fit smoothing splines to very noisy data.
> >
> > I do not have the Spline Toolbox (whose 'spaps' function is recommended for
> > such problems.)
> >
> > How can smoothing splines be implemented with other MATLAB functions? The
> > ordinary 'spline' function simply 'joins the dots' and does not perform
> > smoothing.
> >
> > What other inbuilt function can serve a similar purpose? Are there functions
> > which perform generalized regression without the need to specify a functional
> > form of regression function?
>
>
> Perhaps spfit from the FEX would be useful.
>
> <http://www.mathworks.com/matlabcentral/fileexchange/13812>
>
>
> You might find a general purpose smoothing routine helpful, also.
>
> <http://www.mathworks.com/matlabcentral/fileexchange/17986>
>
> --
> Doug Schwarz
> dmschwarz&ieee,org
> Make obvious changes to get real email address.

Subject: Implementing smoothing splines

From: Doug Schwarz

Date: 20 Nov, 2008 21:24:10

Message: 4 of 5

[top posting repaired]

In article <gg43p9$66m$1@fred.mathworks.com>,
 "Arvind Iyer" <aiyer@ict.usc.edu> wrote:

> Doug Schwarz <see@sig.for.address.edu> wrote in message
> <see-B34D00.23454718112008@news.frontiernet.net>...
> > In article <gg02be$av0$1@fred.mathworks.com>,
> > "Arvind Iyer" <aiyer@ict.usc.edu> wrote:
> >
> > > I need to fit smoothing splines to very noisy data.
> > >
> > > I do not have the Spline Toolbox (whose 'spaps' function is recommended
> > > for
> > > such problems.)
> > >
> > > How can smoothing splines be implemented with other MATLAB functions? The
> > > ordinary 'spline' function simply 'joins the dots' and does not perform
> > > smoothing.
> > >
> > > What other inbuilt function can serve a similar purpose? Are there
> > > functions
> > > which perform generalized regression without the need to specify a
> > > functional
> > > form of regression function?
> >
> >
> > Perhaps spfit from the FEX would be useful.
> >
> > <http://www.mathworks.com/matlabcentral/fileexchange/13812>
> >
> >
> > You might find a general purpose smoothing routine helpful, also.
> >
> > <http://www.mathworks.com/matlabcentral/fileexchange/17986>
>
> Thank you that helped.
>
> I had a couple of follow-up questions.
>
> You've suggested spfit and supersmoother...When is one preferred over the
> other? (I have data with noise of very high variance.)

In my experience, smoothing can be very subjective. You need to use
both tools and see which one seems better to you. Objectively,
supersmoother has the advantage that there are no parameters to set so
if you have trouble knowing where to place the knots in spfit you might
like that. But you must try them on *your* data.

> Also, can the user somehow modify the number of 'pieces' in the spline fit? I
> ask this because, for my data, the outputs of spfit look way too much like
> straight lines. Is this something one lives with (I haven't used splines
> before) or should we alter the options to get 'curvier' splines?

Yes, read the help for spfit. You can place the knots wherever you like
and you can even accommodate known features (like a sharp change in
slope). It's been a while since I used spfit so I don't recall all the
options.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Subject: Implementing smoothing splines

From: Arvind Iyer

Date: 16 Dec, 2008 01:14:02

Message: 5 of 5

Are there important performance limits of these spline functions (from the File Exchange) which limit their applicability?

For instance, do these functions optimally choose the number of breaks when the user does not specify them? Is uniformly sampled data preferably required for these spline functions to perform well?

If indeed these are the limitations of the File Exchange spline functions, do the functions in the MATLAB spline toolbox address them adequately?


Doug Schwarz <see@sig.for.address.edu> wrote in message <see-35BF30.16241020112008@news.frontiernet.net>...
> [top posting repaired]
>
> In article <gg43p9$66m$1@fred.mathworks.com>,
> "Arvind Iyer" <aiyer@ict.usc.edu> wrote:
>
> > Doug Schwarz <see@sig.for.address.edu> wrote in message
> > <see-B34D00.23454718112008@news.frontiernet.net>...
> > > In article <gg02be$av0$1@fred.mathworks.com>,
> > > "Arvind Iyer" <aiyer@ict.usc.edu> wrote:
> > >
> > > > I need to fit smoothing splines to very noisy data.
> > > >
> > > > I do not have the Spline Toolbox (whose 'spaps' function is recommended
> > > > for
> > > > such problems.)
> > > >
> > > > How can smoothing splines be implemented with other MATLAB functions? The
> > > > ordinary 'spline' function simply 'joins the dots' and does not perform
> > > > smoothing.
> > > >
> > > > What other inbuilt function can serve a similar purpose? Are there
> > > > functions
> > > > which perform generalized regression without the need to specify a
> > > > functional
> > > > form of regression function?
> > >
> > >
> > > Perhaps spfit from the FEX would be useful.
> > >
> > > <http://www.mathworks.com/matlabcentral/fileexchange/13812>
> > >
> > >
> > > You might find a general purpose smoothing routine helpful, also.
> > >
> > > <http://www.mathworks.com/matlabcentral/fileexchange/17986>
> >
> > Thank you that helped.
> >
> > I had a couple of follow-up questions.
> >
> > You've suggested spfit and supersmoother...When is one preferred over the
> > other? (I have data with noise of very high variance.)
>
> In my experience, smoothing can be very subjective. You need to use
> both tools and see which one seems better to you. Objectively,
> supersmoother has the advantage that there are no parameters to set so
> if you have trouble knowing where to place the knots in spfit you might
> like that. But you must try them on *your* data.
>
> > Also, can the user somehow modify the number of 'pieces' in the spline fit? I
> > ask this because, for my data, the outputs of spfit look way too much like
> > straight lines. Is this something one lives with (I haven't used splines
> > before) or should we alter the options to get 'curvier' splines?
>
> Yes, read the help for spfit. You can place the knots wherever you like
> and you can even accommodate known features (like a sharp change in
> slope). It's been a while since I used spfit so I don't recall all the
> options.
>
> --
> Doug Schwarz
> dmschwarz&ieee,org
> Make obvious changes to get real email address.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
optimal choice ... Arvind Iyer 15 Dec, 2008 20:15:20
limitations in ... Arvind Iyer 15 Dec, 2008 20:15:20
supersmoother Arvind Iyer 20 Nov, 2008 11:40:25
spfit Arvind Iyer 20 Nov, 2008 11:40:25
nonlinear regre... Arvind Iyer 18 Nov, 2008 22:50:20
spline toolbox Arvind Iyer 18 Nov, 2008 22:50:20
smoothing spline Arvind Iyer 18 Nov, 2008 22:50:20
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com