[SciPy-User] an exercise in spline basis functions

Charles R Harris charlesr.harris at gmail.com
Fri Dec 9 12:00:56 EST 2011


On Thu, Dec 8, 2011 at 11:53 PM, <josef.pktd at gmail.com> wrote:

> Trying to understand spline basis functions, I always wanted to have
> something simple to play with (that is not hidden in C or Fortran code
> behind a lot of numerical sophistication).
>
> Here is a very simple example, coded straight from a beginner's
> explanation. And it even works.
>
>
> https://picasaweb.google.com/106983885143680349926/Joepy#5684006069657083426
>
> https://picasaweb.google.com/106983885143680349926/Joepy#5684006072774057874
>
> Motivation
> If we have the basis functions directly, then we can just treat them
> like regular regressors, e.g. for robust fitting, have more control
> and information over variable selection than using scipy's splines, or
> include them at the same time as other regressors.
> (I'm thinking mainly of noisy data with a small number of breaks/knots.)
> (and because I was looking at what's left of the old stats.models
> spline code, where most of it got removed because it was crashing C
> code.)
>
> This was mainly to see if it works.
> Is there better code to get the spline basis functions (and maybe the
> derivatives, ...) available somewhere?
>
>
Looks like you are using uniform b-splines. You might want to look at the
non-uniform variety also. If you want a complete set both require extra
knot points outside the interior of the domain, but for the non-uniform
variety the added knot points are just repeats of the end points.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20111209/6ece46e4/attachment.html>


More information about the SciPy-User mailing list