R: Perform Total Variation Denoising on a 1-Dimensional Signal
tvd1d
R Documentation
Perform Total Variation Denoising on a 1-Dimensional Signal
Description
When supplied a noisy sequential signal in vector y, performs
TVD with regularization parameter lambda, and returns a
denoised version of y.
Usage
tvd1d(y, lambda, method = "Condat")
Arguments
y
a numeric vector of sequential noisy data values
lambda
the total variation penalty coefficient
method
a string indicating the algorithm to use for
denoising. Currently only supports method "Condat"
Details
1D TVD is a filtering technique for a sequential univariate signal that attempts
to find a vector x_tvd that approximates a noisy vector y, as:
x_tvd = argmin_x(E(x, y) + λ*V(x))
where E(x, y) is a loss function measuring the error in approximating
y with x, and V(x) is the total variation of x:
V(x) = sum(|x_{i+1} - x_{i}|)
TVD is particularly well-suited to recovering piecewise constant
signals. The degree of approximation is controlled by the parameter
lambda: for lambda = 0, x_tvd = y, and as lambda increases, x_tvd
contains increasingly fewer value transitions, until, for a high
enough value, it is constant.
Currently only implements Condat's fast squared-error loss TVD
algorithm (method "Condat"), which is restricted to vectors of
length 2^32 - 1 and shorter.
Value
a numeric vector of the same length as y, containing
denoised data.