Impose probability floor.
Imposes a floor on the given array a, ensuring that its elements are greater than or equal to amin.
impose_floor(a, amin)
a
: Numeric vector. Must not contain NA values.amin
: Numeric. Minimum allowed value. Must be between 0 and 1.A numeric vector with the same length as a
, with the floor imposed on its elements.
a <- c(0.25, 0.25, 0.25, 0.25) imposed_a <- impose_floor(a = a, amin = 0.1)
Useful links