R/Extremes.reduction.R

Defines functions Extremes.reduction

Documented in Extremes.reduction

#' Extremes.reduction
#'
#' Function to reduce the most extreme low and high events to their less extreme border.
#' Currently, the standard is a tenth of a permille.
#' @param x A vector of numeric values
#' @param high_percent The cutoff to which all higher values will be returned
#' @param low_percent The corresponding low cutoff to which all lower values will be returned
#' @return A vector where the most extreme outliers have been made normal
#' @export
Extremes.reduction <- function(x, high_percent=0.9999, low_percent=0.0001){
	high <- hdquantile(x, high_percent)
    low <- hdquantile(x, low_percent)
    print(high)
    print(low)

    x[x > high] <- high
    x[x < low] <- low
	return(x)
}
jtheorell/MyTestPackage documentation built on May 19, 2017, 12:47 a.m.