Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe14.iad.POSTED!7564ea0f!not-for-mail
From: Doug Schwarz <see@sig.for.address.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Implementing smoothing splines
References: <gg02be$av0$1@fred.mathworks.com> <see-B34D00.23454718112008@news.frontiernet.net> <gg43p9$66m$1@fred.mathworks.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
User-Agent: MT-NewsWatcher/3.5.2 (Intel Mac OS X)
Message-ID: <see-35BF30.16241020112008@news.frontiernet.net>
Lines: 63
X-Complaints-To: abuse-news@frontiernet.net
NNTP-Posting-Date: Thu, 20 Nov 2008 21:24:04 UTC
Organization: Frontier
Date: Thu, 20 Nov 2008 16:24:10 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:502152


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