[SciPy-User] an exercise in spline basis functions

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Dec 9 01:53:36 EST 2011


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?


Josef
I might not understand it, but it works -- maybe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: try_spline_basis_1.py
Type: text/x-python
Size: 2662 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20111209/39f1c6d5/attachment.py>


More information about the SciPy-User mailing list