I need to calculate the derivative of an M-Spline. Since an M-Spline is for the interior knots just a rescaled B-Spline, I can just use the same formula as given in the Wikipedia article. However, for all splines whose support touches the boundary knots, which for M-Splines are repeated k times (where k is the degree of the M-Spline), I am getting wrong results when naively applying the formula, compared to a numerical approximation of the gradient (see the plots for the first 3 splines of degree 3). So I guess there is some sort of weighting that has to be done to account for the repetition of the outer knots, but I am not sure how to do it.
Asked
Active
Viewed 89 times
0
-
Do you need M-splines in particular or could you simply use B-splines? There are usually more resources for B-splines... – PC1 Jul 01 '22 at 04:14
-
No, I need M-Splines in particular unfortunately I think it should be similar though for B-Splines, I think the problem is likely that the outer knots are degenerate, since M-Splines are just B-Splines with degenerate outer knots and a different scaling, which shouldn't change anything here though I think (since it does work for the interior knots) – Luca Thiede Jul 01 '22 at 05:42
-
To be frank, I don't know much the difference between B and M splines. I used B-splines extensively and you can place the knots wherever you want, including superposing knots on the boundary. Are M-splines just a restriction (being positive) on B-splines? – PC1 Jul 01 '22 at 06:08
-
Yes, they are restricted and the k=1 M-Splines are not 1 on their respective intervals, but 1/(width of that interval), such that they would be integrating to one. So their derivatives should be the same as for B-Splines. – Luca Thiede Jul 01 '22 at 14:53
-
What you're describing here seem to be B-splines, with the restriction that coefficients must be positive. If so, why not use B-splines and enforce the restriction on the coefficients? – PC1 Jul 01 '22 at 18:31
-
Thats what I am effectively doing, they are simply rescaled such that they integrate to one (which means they can be used as a probability distribution, unlike normal B-Splines). My problem is, that the B-Spline derivative formula seems to not be working if knots are degenerate – Luca Thiede Jul 01 '22 at 18:37
-
Maybe the formula is fine, and my implementation is wrong, I can post my code if that helps – Luca Thiede Jul 01 '22 at 18:39
-
You should not rescale the B-spline basis, that's not a great idea if you need to derive or integrate them. It makes formulas complicated and prone to mistakes. Just ensure that your normalization is correct for the probability, by working on the coefficients, not on the basis. Also, if your function is always positive then no coefficient can be negative (I believe that this is the only practical difference between B and M splines). – PC1 Jul 01 '22 at 18:41
-
That is what M-Splines are all about though, and generally, it seems to work. I don't think the rescaling is the problem, since the derivative formula works fine for the non degenerate knots – Luca Thiede Jul 01 '22 at 18:42


