R/clip.small.probs.R

Defines functions clip.small.probs

Documented in clip.small.probs

clip.small.probs <- function(x, min.prob = NULL) {
    if (!is.null(min.prob)) {
        if(min(x) < min.prob) {
            warning("Small probabilities encountered. Replacing with min.prob.")
            x[x < min.prob] <- min.prob
        }
    }
    if (min(x) <= 0 & is.null(min.prob)) {
        warning("Probabilities <= 0 encountered and min.prob not set. Replacing with smallest value > 0.")
        x[x <= 0] <- min(x[x > 0])
    }
    return(x)
}

Try the icsw package in your browser

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

icsw documentation built on May 1, 2019, 7:29 p.m.