Learn R Programming

WLasso (version 1.0)

top_thresh: Thresholding to a given threshold of the smallest values

Description

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

Usage

top_thresh(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.

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

Run this code
# NOT RUN {
x=sample(1:10,10)
sorted_vect=sort(x,decreasing=TRUE)
thresh=3
top_thresh(x,thresh,sorted_vect)
# }

Run the code above in your browser using DataLab