clip.small.probs: 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.
Value
Vector the same length as x with, possibly, some entries replaced.
Details
Used to avoid small probabilities blowing up in inverse probability weighting.
Produces warnings whenever values are actually replaced.
# NOT RUN {probs <- seq(0, .01, by = .001)
min(clip.small.probs(probs, .05))
# without min.prob, uses smallest value > 0min(clip.small.probs(probs))
# }