is there a reference to a journal paper for the selection of the smoothing parameter p = 1(1 + h3/60) in Matlab command csaps
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Branko Celler
el 5 de Oct. de 2023
% Fit cubic spline
%h=average distance between CP points;
p = 1/(1 + h^3/0.6); % Satisfactory smoothing for evenly spaced data
CPvalues=[];
CPvalues=csaps(CPowe,CPOWE,p);
% Is there a journal reference for the choice of smoothing parameter p = 1/(1 + h^3/0.6)
4 comentarios
Walter Roberson
el 7 de Oct. de 2023
@John D'Errico -- would you happen to have encountered information about this choice of smoothing parameter when you were doing your spline work?
Respuesta aceptada
Drew
el 25 de Oct. de 2023
Editada: Drew
el 25 de Oct. de 2023
The algorithms section of the csaps doc page https://www.mathworks.com/help/curvefit/csaps.html begins with this
- csaps is an implementation of the Fortran routine SMOOTH from PGS.
The reference to PGS in the first point is resolved by another doc page https://www.mathworks.com/help/curvefit/curve-fitting-toolbox-splines-and-matlab-splines.html which says
- Curve Fitting Toolbox™ spline functions contain versions of the essential MATLAB® programs of the B-spline package (extended to handle also vector-valued splines) as described in A Practical Guide to Splines, (Applied Math. Sciences Vol. 27, Springer Verlag, New York (1978), xxiv + 392p; revised edition (2001), xviii+346p), hereafter referred to as PGS.
So, PGS refers to the book A Practical Guide to Splines by Carl de Boor. The acknowledgements section of the https://www.mathworks.com/help/curvefit/curve-fitting-toolbox-splines-and-matlab-splines.html page goes on to say:
- MathWorks® would like to acknowledge the contributions of Carl de Boor to the Curve Fitting Toolbox spline functions. Professor de Boor authored the Spline Toolbox™ from its first release until Version 3.3.4 (2008).
- Professor de Boor received the John von Neumann Prize in 1996 and the National Medal of Science in 2003. He is a member of both the American Academy of Arts and Sciences and the National Academy of Sciences. He is the author of A Practical Guide to Splines (Springer, 2001).
Regarding your choice of p taken from the suggestions in the documentation, the "p - Smoothing Parameter" section of the csaps doc page https://www.mathworks.com/help/curvefit/csaps.html thoroughly describes the tradeoffs involved in choosing p. The explanation in the doc includes this, which is where you obtained the suggestion:
- "The favorable range for p is often near 1/(1 + h^3/6), where h is the average spacing of the data sites. The function chooses a default value for p within this range. For uniformly spaced data, you can expect a close fit with p = 1(1 + h^3/60) and some satisfactory smoothing with p = 1/(1 + h^3/0.6). "
At the high level, the reasoning behind the formula lies in the desire to achieve a smooth curve while maintaining a balance between fitting the data closely and avoiding overfitting. By incorporating the average spacing, h, into the formula, this equation takes into account the density of data points.
The m-file help for csaps has more info which includes this section
help csaps
....
% When P is 0, the smoothing spline is the least-squares straight line fit
% to the data, while, at the other extreme, i.e., when P is 1, it is the
% `natural' or variational cubic spline interpolant. The transition region
% between these two extremes is usually only a rather small range of values
% for P and its location strongly depends on the data sites. It is in this
% small range that P is chosen when it is not supplied, or when an empty
% P or a negative P is input.
The algorithms section of the csaps doc page https://www.mathworks.com/help/curvefit/csaps.html ends with this statement:
- The calculation of the smoothing spline requires solving a linear system whose coefficient matrix has the form p*A + (1-p)*B, with the matrices A and B depending on the data sites x. The default value of p makes p*trace(A) equal (1-p)*trace(B).
The above sheds some light on the choice of the default p.
In conclusion, more info can be obtained from:
- csaps doc page https://www.mathworks.com/help/curvefit/csaps.html
- The book A Practical Guide to Splines (Springer 2001) by Carl de Boor. The SMOOTH function, which is the basis for csaps, appears in chapter 14.
- The m-file help for the csaps function, using "help csaps"
- Reading the csaps code, using "open csaps"
If this answer helps you, please remember to accept the answer.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!