incline.PenalizedSpline¶
- class incline.PenalizedSpline(lam=None)[source]¶
Smoothing spline with a fixed roughness penalty.
Linear, because the penalty is fixed rather than chosen from the data. This is the spline to use when exact standard errors matter; see
InterpolatingSplinefor the knot-selecting alternative.- Variables:
lam (float | None) – Roughness penalty. Chosen by generalized cross-validation when None – which makes the fit data-dependent and therefore nonlinear.
- Parameters:
lam (float | None)
Methods
__init__([lam])analytic_operators(axis, order)State the smoothing and derivative operators directly, if known.
evaluate(axis, y, order)Fit the penalized spline and differentiate it.
fit(axis, y[, order, se, noise, ...])Estimate the trend and, optionally, its uncertainty.
native_posterior(axis, y, order, ...)Uncertainty from the smoother's own probability model.
operators(axis, order)The smoothing and derivative operators for this configuration.
params()Report the penalty.
scale_of(axis)Invert the bandwidth-to-penalty map.
with_scale(scale, axis)Set the penalty from an equivalent bandwidth.
Attributes
has_native_posteriorLinear when the penalty is fixed, not cross-validated.
linearrequires_regular_grid- with_scale(scale, axis)[source]¶
Set the penalty from an equivalent bandwidth.
For a cubic smoothing spline the equivalent kernel width behaves like
(lam / n) ** (1/4), so a target width ofscale * spanimplieslam = n * (scale * span) ** 4.