R/HPDcrd.R

Defines functions HPDcrd

Documented in HPDcrd

HPDcrd <- function(x, alpha = 0.05) {
    n <- length(x)
    nn <- round(alpha * n)
    x <- sort(x)
    xx <- x[(n - nn + 1):n] - x[1:nn]
    m <- min(xx)
    nnn <- which(xx == m)[1]
    return(c(x[nnn], x[n - nn + nnn]))
}

Try the evidence package in your browser

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

evidence documentation built on May 2, 2019, 2:14 p.m.