top: Thresholding to zero of the smallest values

Description Usage Arguments Value Author(s) References Examples

View source: R/top.R

Description

This function keeps only the K largest values of the vector sorted_vect and sets the others to zero.

Usage

1
top(x, thresh, sorted_vect)

Arguments

x

vector to threshold

thresh

threshold

sorted_vect

vector x sorted in descending order

Value

This function returns the thresholded vector.

Author(s)

Wencan Zhu [aut, cre], Celine Levy-Leduc [ctb], Nils Ternes [ctb]

References

W. Zhu, C. Levy-Leduc, N. Ternes. "A variable selection approach for highly correlated predictors in high-dimensional genomic data". arXiv:2007.10768.

Examples

1
2
3
4
x=sample(1:10,10)
sorted_vect=sort(x,decreasing=TRUE)
thresh=3
top(x,thresh,sorted_vect)

WLasso documentation built on Aug. 13, 2020, 5:06 p.m.