Description Usage Arguments Value Author(s) References See Also Examples
This is a function that solves the structural filtering problem with L0 penalty via the primal dual active set algorithm. It fits a non-parametric regression model by minimizing the number of nonzero values in D*beta with constraints on the least squares error.
1 |
y |
Response sequence to be filtered. |
D |
Penalty matrix on coeffient beta. |
tau |
Step length for searching the best model, i.e., in the t-th iteration, a model with tau*t knots will be fitted. |
s.max |
The maximum nubmer of knots in the penalized coefficient(breaks in |
eps |
Early stop criterion. The algorithm stops when mean squared error is less than eps. |
ddinv |
The inverse matrix of |
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. |
beta.all |
Solution path of fitted value, beta, corresponding to different degrees of freedom. |
df |
A vector giving an unbiased estimate of the degrees of freedom of the fit, i.e., the number of nonzero values in |
Canhong Wen, Xueqin Wang, Yanhe Shen, Aijun Zhang
Wen,C., Wang, X., Shen, Y., and Zhang, A. (2017). "L0 trend filtering", technical report.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | require(limSolve)
n <- 1000
sigma <- 0.5
y0 <- rep(0,n)
y0[100:150] <- 2
y0[400:600] <- -1
y0[800:810] <- 4
y <- y0 + sigma*rnorm(n)
y[800:810] <- y0[800:810] + sigma*rnorm(11)
D0 <- matrix(0, n-1,n)
diag(D0) <- -1
for(i in 1:(n-1)) D0[i,i+1] <- 1
ddt <- D0%*%t(D0)
ddinv<- Solve.banded(ddt, 1,1, B = diag(1,dim(D0)[1]))
re <- fsf.ada(y, D0, tau = 1, s.max = 10, eps = 0.1, ddinv = ddinv)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.