Draws n independent samples from the discrete distribution with
probability mass pmf[i] at boundaries[i+1].
Arguments
- n
Integer. Number of samples to draw.
- boundaries
Numeric vector of length \(K+1\) defining the bin edges. Must be strictly increasing. Defaults to
0:K(unit-width daily bins) whereKis inferred fromlength(pmf).- pmf
Numeric vector of length \(K\) giving the probability mass for each bin. Must be non-negative and sum to approximately 1; if either condition is violated the function returns a vector of zeros (a soft simplex penalty for use inside optimisation).
See also
Other pdiscretestep:
ddiscretestep(),
hazards_to_pmf(),
pdiscretestep(),
pmf_to_hazards()
