sablib
Loading...
Searching...
No Matches
pspline.h File Reference

Smoothing using penalized Spline(P-Spline). More...

#include <stdexcept>
#include <vector>
#include "../misc/bspline.h"

Go to the source code of this file.

Functions

const std::vector< double > sablib::PSpline (const std::vector< double > &y, const unsigned int knots_num, const unsigned int degree=3, const unsigned int s=2, const double lambda=1.0)
 Smoothes the input data using P-Splines (Penalized B-Splines).

Detailed Description

Smoothing using penalized Spline(P-Spline).

Author
Izadori

References:

  • Eilers, P. H. C.; Marx, B. D. Flexible Smoothing with B-Splines and Penalties. Stastical Science, 1996, 11(2), 89-121.

Definition in file pspline.h.

Function Documentation

◆ PSpline()

const std::vector< double > sablib::PSpline ( const std::vector< double > & y,
const unsigned int knots_num,
const unsigned int degree = 3,
const unsigned int s = 2,
const double lambda = 1.0 )

Smoothes the input data using P-Splines (Penalized B-Splines).

This function applies a B-Spline basis with a difference penalty on the coefficients to achieve smoothing of the input data.

Parameters
yThe input data points to be smoothed.
knots_numThe number of internal knots for the B-Spline basis.
degreeThe degree of the B-Spline basis (default is 3, cubic spline).
sThe order of the difference penalty (default is 2).
lambdaThe smoothing parameter (default is 1.0). Larger values result in smoother curves.
Returns
A vector containing the smoothed data points.
Exceptions
std::invalid_argumentOne or more parameters are wrong.

Definition at line 15 of file pspline.cpp.

References sablib::BSpline< Scalar >::DesignMatrix(), and sablib::BSpline< Scalar >::Interpolate().