| Title: | Univariate Total Variation Denoising |
|---|---|
| Description: | Total variation denoising can be used to approximate a given sequence of noisy observations by a piecewise constant sequence, with adaptively-chosen break points. An efficient linear-time algorithm for total variation denoising is provided here, based on Johnson (2013) <doi:10.1080/10618600.2012.681238>. |
| Authors: | Addison Hu [ctb], Daniel McDonald [ctb], Ryan Tibshirani [aut, cre, cph] |
| Maintainer: | Ryan Tibshirani <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0.9000 |
| Built: | 2026-05-21 07:07:00 UTC |
| Source: | https://github.com/glmgen/tvdenoising |
Denoises a sequence of observations by solving the univariate total variation denoising optimization problem at a given regularization level.
tvdenoising(y, lambda, weights = NULL)tvdenoising(y, lambda, weights = NULL)
y |
Vector of observations to be denoised. |
lambda |
Regularization parameter value. Must be >= 0. |
weights |
Vector of observation weights. The default is |
This function minimizes the univariate total variation denoising (also called fused lasso) criterion squares criterion
over . This is a special structured convex optimization problem
which can be solved in linear time ( operations) using algorithms
based on dynamic programming (Viterbi) or taut string methods. The current
function implements a highly-efficient dynamic programming method developed
by Johnson (2013).
Vector of denoised values.
Johnson (2013), "A dynamic programming algorithm for the fused lasso and L0-segmentation."
y <- c(rep(0, 50), rep(3, 50)) + rnorm(100) yhat <- tvdenoising(y, 5) plot(y, pch = 16, col = "gray60") lines(yhat, col = "firebrick", lwd = 2)y <- c(rep(0, 50), rep(3, 50)) + rnorm(100) yhat <- tvdenoising(y, 5) plot(y, pch = 16, col = "gray60") lines(yhat, col = "firebrick", lwd = 2)