I have some (x,y) data with equally-spaced x’s. I would like to smooth the data using (up to) 4 cubic splines and obtain the equations for each spline. I would like the knots connecting the splines to move to an optimal position which minimizes the total R^2 distance from the splines to the raw data.
I don’t know what the above mathematical approach would be called to research it further. I read about smoothing splines, but the \lambda parameter seems at odds with my desire to fix the number of knots to unequal distances. I also see that basis splines are commonly implemented in Julia packages, but I am having trouble understanding them and if they would suit my needs. Why, for instance, would I use a cubic basis spline instead of a natural cubic spline? Spline interpolation which creates a spline between every consecutive data point would not suit my needs.
Moreover, I don’t know what the best Julia package for this would be. I found several packages that seem to be related to curve fitting, but I could use some advice on which to try implementing.
Interpolations.jl
GLM.jl
LsqFit.jl
CurveFit.jl
Dierckx.jl
ApproxFun.jl
DataInterpolations.jl
SmoothingSplines.jl
I am fine with initially taking a brute-force approach for determining the knot locations if optimization adds too much complexity. I could compute every possible combination of knot locations in a loop and then take the minimum R^2. The length of my data is of order 100.