R/threshld.R

Defines functions threshld

Documented in threshld

threshld <- function(x, t, hard = TRUE) {
#
#  threshold the data x using threshold t
#  if hard=TRUE use hard thresholding
#  if hard=FALSE use soft thresholding
	if(hard) z <- x * (abs(x) >= t) else {
		z <- sign(x) * pmax(0, abs(x) - t)
	}
	return(z)
}

Try the EbayesThresh package in your browser

Any scripts or data that you put into this service are public.

EbayesThresh documentation built on May 2, 2019, 8:36 a.m.