[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Constraints for B-spline breakpoints
From: |
Patrick Alken |
Subject: |
Re: [Help-gsl] Constraints for B-spline breakpoints |
Date: |
Tue, 13 Oct 2009 09:33:25 -0600 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Yes, as Rhys said, it shouldn't matter having more bspline coefficients
than data points, as bsplines don't really care about how many
data points you have. Its only when you try to least squares fit
the data to your coefficients that a problem can come up (as you
found in the svd error).
When you have a least squares model with more coefficients than data,
it is called "overdetermined", ie: you have more equations than
unknowns, and in general a solution will not exist for such a
system. Least squares, however, can be used to find an approximate
solution to such a system, however GSL does not currently implement
this case.
I think LAPACK may have support for overdetermined least squares
systems so that may be your best bet for now. I'm not aware of
any plans to implement the m > n case in GSL in the immediate
future.
Patrick Alken
On Tue, Oct 13, 2009 at 07:47:48AM -0500, Rhys Ulerich wrote:
> > I'm using the GSL B-spline functions to implement cubic spline smoothing.
> > My program is based on the example in the manual
> > (http://www.gnu.org/software/gsl/manual/html_node/Example-programs-for-B_002dsplines.html).
> >
> > I want to allow varying numbers of breakpoints (nbreak) to achieve different
> > degrees of smoothing. The minimum nbreak for cubic splines is 2, but is
> > there a maximum?
>
> There should not be from the gsl_bspline routines.
>
> > If I use more than n-2 (where n is the number of data
> > points), I get an error from "gsl_multifit_wlinear" when computing the
> > spline coefficients:
> > gsl: svd.c:236: ERROR: svd of MxN matrix, M<N, is not implemented
> >
> > For the offending fit matrix, M = n and N = ncoeffs = nbreak+k-2 = nbreak+2.
>
> I'm not familiar with the svd routine. Someone else will have to jump in
> here.
>
> > Is there a way to use every (distinct location of a) data point as a
> > breakpoint (via "gsl_bspline_knots")?
>
> Yes, that should be possible if you get past the SVD constraint from above.
> In that case you're just fitting a cubic spline interpolant and you may wish
> to use http://www.gnu.org/software/gsl/manual/html_node/Interpolation.html
>
> > Would it be possible to have more breakpoints than data points?
>
> Probably, if you're working in a least squares sense.
>
> > If so, would it make any sense to allow this?
>
> I'm not sure that you'll gain anything.
>
> - Rhys
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl