clip.small.probs: Replace probabilities below threshold with threshold value

Description Usage Arguments Details Value Author(s) Examples

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))


Search within the icsw package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.