Replace probabilities below threshold with threshold value

Share:

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

1
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

1
2
3
4
5
probs <- seq(0, .01, by = .001)
min(clip.small.probs(probs, .05))

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