fsfused {FastSF} | R Documentation |
Fast Sparse Fused Regression
Description
This is a function that solves the L0 fused problem via the primal dual active set algorithm in sparse condition. It fits a piecewise constant regression model by minimizing the least squares error with constraints on the number of breaks in their discrete derivative.
Usage
fsfused(y, s = 10, T, K.max=5)
Arguments
y |
Response sequence to be fitted. |
s |
Number of knots in the piecewise constant(breaks in the derivative), default is 10. |
T |
Number of non-zero values in fitted coefficient. |
K.max |
The maximum number of steps for the algorithm to take before termination. Default is 5. |
Value
y |
The observed response vector. Useful for plotting and other methods. |
beta |
Fitted 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
Examples
n <- 1000
sigma <- 0.5
y0 <- rep(0,n)
y0[100:150] <- 2.5
y0[400:600] <- -2.4
y0[800:810] <- 4
y <- y0 + sigma*rnorm(n)
re = fsfused(y, s = 10, T = 300)