soft: The soft thresholding function

Description Usage Arguments Value Examples

View source: R/soft.R

Description

Element-wise application of the soft thresholding function given by

soft(a, c) = sgn(a)*max(|a| - c, 0)

Usage

1
soft(a, c)

Arguments

a

A numeric vector or matrix to apply the soft thresholding function on.

c

A numeric giving the soft threshold.

Value

A numeric vector or matrix the same size as a with thresholded values.

Examples

1
2
3
4
5
a <- rnorm(100)
soft(a, c = 0.2)
  
x <- createData(n = 10, m = 4)
soft(x, c = 0.7)

AEBilgrau/correlateR documentation built on Nov. 15, 2019, 9:21 a.m.