softK {mogsa} | R Documentation

## Soft-thresholding operator

### Description

Weighted soft-thresholding operator, which is called by `mbpca`.

### Usage

    softK(x, k, w = 1, pos = FALSE)

### Arguments

`x` | A numerical vector
`k` | Number of non-zero elements want to keep
`w` | weight for each element. The actual thresholding is base on x*w, the default setting equals to ordinary soft thresholding.
`pos` | A logical value, if only positive values are retained.

### Value

A thresholded numerical vector

### Author(s)

Chen Meng

### Examples

    v <- rnorm(10)
    softK(v, k = 2)

[Package mogsa version 1.24.0 Index]