ts_fil_spline: Smoothing Splines

View source: R/ts_fil_spline.R

ts_fil_splineR Documentation

Smoothing Splines

Description

Fits a cubic smoothing spline to a time series.

Usage

ts_fil_spline(spar = NULL)

Arguments

spar

smoothing parameter. When spar is specified, the coefficient of the integral of the squared second derivative in the fitting criterion (penalized log-likelihood) is a monotone function of spar. #'@return a ts_fil_spline object.

Examples

# time series with noise
library(daltoolbox)
data(tsd)
tsd$y[9] <- 2*tsd$y[9]

# filter
filter <- ts_fil_spline(spar = 0.5)
filter <- fit(filter, tsd$y)
y <- transform(filter, tsd$y)

# plot
plot_ts_pred(y=tsd$y, yadj=y)

tspredit documentation built on June 22, 2025, 5:07 p.m.