R/wdist.R

Defines functions wdist

Documented in wdist

wdist <- function(d, h, cri = 4, squared = FALSE) {
    
    d <- c(d)
    if(squared)
        d <- d^2

    zmed <-  median(d)
    zmad <- mad(d)
    w <- ifelse(d < zmed + cri * zmad, exp(-d / (h * zmad)), 0)
    w <- w / max(w)
    
    w[is.na(w) | is.nan(w)] <- 1
        
    w
    
    }

Try the rchemo package in your browser

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

rchemo documentation built on Sept. 11, 2024, 8:05 p.m.