soft_thresh: Soft-thresholding Function

Description Usage Arguments Details Examples

View source: R/utilities.R

Description

Simple vectorized soft-thresholding utility function.

Usage

1
soft_thresh(x, lambda)

Arguments

x

Vector to be soft-thresholded

lambda

Threshold value

Details

This function is not exported, as it is an internal utility function. Use spca:::soft_thresh to access it.

Examples

1
2
3
4
5
6
7
set.seed(1)
(z <- rnorm(10))
spca:::soft_thresh(z, 0.5)

y <- seq(from = -2, to = 2, by = 0.1)
plot(y, spca:::soft_thresh(y, 0.4), type = "l")
lines(y, y, lty = 3)

schoonees/spca documentation built on Jan. 31, 2021, 6:21 p.m.