This function applies soft-thresholding to the input values, setting values below the threshold to zero
and shrinking the remaining values by the threshold amount.
Usage
soft_threshold(x, threshold)
Arguments
- x
A numeric vector of input values
- threshold
A non-negative threshold value for the soft-thresholding operation
Value
A numeric vector with the soft-thresholded values
Examples
x <- c(-3, -2, -1, 0, 1, 2, 3)
threshold <- 1
soft_thresholded <- soft_threshold(x, threshold)
#> Error in soft_threshold(x, threshold): could not find function "soft_threshold"
print(soft_thresholded)
#> Error in print(soft_thresholded): object 'soft_thresholded' not found