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.

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

`x` |
Vector of probabilities. |

`min.prob` |
Threshold. Values smaller than |

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

Produces warnings whenever values are actually replaced.

Vector the same length as `x`

with, possibly, some entries replaced.

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

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

Questions? Problems? Suggestions? Tweet to @rdrrHQ 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.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.