clip.small.probs {icsw}R Documentation

Replace probabilities below threshold with threshold value

Description

Return the provided vector with values smaller than the provided threshold replaced with that threshold (i.e., clip the probabilities below a certain value). If the threshold is chosen to match an empirical quantile then this can be used to implement Winsorizing probabilities from below. If no threshold is provided, the smallest value greater than zero is used.

Usage

clip.small.probs(x, min.prob = NULL)

Arguments

x

Vector of probabilities.

min.prob

Threshold. Values smaller than min.prob are replaced with min.prob. If not provided, set to the smallest value in x greater than 0.

Details

Used to avoid small probabilities blowing up in inverse probability weighting.

Produces warnings whenever values are actually replaced.

Value

Vector the same length as x with, possibly, some entries replaced.

Author(s)

Peter M. Aronow <peter.aronow@yale.edu>, Dean Eckles <icsw@deaneckles.com>, Kyle Peyton <kyle.peyton@yale.edu>

Examples


probs <- seq(0, .01, by = .001)
min(clip.small.probs(probs, .05))

# without min.prob, uses smallest value > 0
min(clip.small.probs(probs))


[Package icsw version 1.0.0 Index]