ftf: Fast Trend Filtering

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ftf.R

Description

This function solves the structural filtering problem via the primal dual active set algorithm. It fits a k-th order piecewise polynomial by minimizing the least squares error with constraints on the number of breaks in their (k + 1)-st discrete derivative, for a chosen integer k >= 0.

Usage

1
 ftf(y, k = 1, s = 20, K.max = 5)

Arguments

y

Numeric vector of inputs.

k

An integer specifying the desired order of the piecewise polyomial produced by the solution of the trend filtering problem. Must be non-negative, and the default to 1 (linear trend filtering).

s

Number of knots in the piecewise polynomial(breaks in the (k+1)-st derivative), default is 20.

K.max

The maximum number of steps for the algorithm to take before termination. Default is 5.

Details

The L0 trend filtering fits an adaptive piecewise polynomial to linearly ordered observations with contraints on the number of knots, for a chosen integer k >= 0. The knots or the breaks in their (k + 1)-st discrete derivative are chosen adaptively based on the observations.

Value

y

The observed response vector. Useful for plotting and other methods.

beta

Filtered value.

v

Primal coefficient. The indexes of the nonzero values correspond to the locations of the breaks.

Author(s)

Canhong Wen, Xueqin Wang, Yanhe Shen, Aijun Zhang

References

Wen,C., Wang, X., Shen, Y., and Zhang, A. (2017). "L0 trend filtering", technical report.

See Also

plotl0.

Examples

1
2
3
4
5
6
set.seed(1)

sigma <- 0.5
y0 <- c((10:30)/3, (40:10)/4, 2:8)
y <- y0 + sigma*rnorm(length(y0))
re <- ftf(y, k = 1, s = 5)

FastSF documentation built on May 2, 2019, 8:27 a.m.

Related to ftf in FastSF...