softK: weighted soft thresholding a vector

Description Usage Arguments Details Author(s) Examples

Description

soft-thresholding a vector with possibility of using weight and non-negative constraint

Usage

1
softK(x, k, w = 1, pos = FALSE, round.digits = 12)

Arguments

x

a vector

k

the number (if integer k>1) or proportion (if 0<k<1) of non-zero elements

w

the weight for each element, see "detail" section

pos

if only retain non-negative values

round.digits

the digits to be passed to round function.

Details

using weight w The vector x*w is used to determine which value to keep, but the values in x are kept. For example, the vector x is c(1, 2, 3, 4, 5), w is c(2.5, 2.5, 2.5, 1, 1), the weighted vector is c(2.5, 5, 7.5, 4, 5). If k = 3, value in x corresponding to 5, 7.5 and 5 (i.e. 2, 3, 5) will be selected, after thresholding, the values becomes 1, 2, 4.

Author(s)

Chen Meng

Examples

1
2
 
softK(1:5, w=c(2.5, 2.5, 2.5, 1, 1), k = 3)

mengchen18/omic3plus documentation built on May 6, 2019, 4:59 p.m.