[SciPy-User] B-spline basis functions?
Skipper Seabold
jsseabold@gmail....
Tue Jul 31 13:25:15 CDT 2012
On Tue, Jul 31, 2012 at 11:37 AM, Nathaniel Smith <njs@pobox.com> wrote:
> Hi all,
>
> I'd like to be able to do spline regression in patsy[1], which means
> that I need to be able to compute b-spline basis functions. I am not
> an initiate into the mysteries of practical spline computations, but I
> *think* the stuff in scipy.signal is not quite usable as is, because
> it's focused on doing interpolation directly rather than exposing the
> basis functions themselves?
>
> Specifically, to achieve feature parity with R [2], I need to be able to take
> - an arbitrary order
> - an arbitrary collection of knot positions (which may be irregularly spaced)
> - a vector x of points at which to evaluate the basis functions
> and spit out the value of each spline basis function evaluated at each
> point in the x vector.
>
> It looks like scipy.signal.bspline *might* be useful, but I can't
> quite tell? Or alternatively someone might have some code lying around
> to do this already?
>
Josef will know more about this. I think he cleaned it up to work with
scipy instead of the segfaulting C code we had. We've been carrying it
around for a while, but I haven't had a chance to brush up yet.
https://github.com/statsmodels/statsmodels/blob/master/statsmodels/sandbox/bspline.py
Skipper
More information about the SciPy-User
mailing list