Returns the CDF of a discrete distribution whose mass is concentrated at
the right boundary of each bin. The CDF is right-continuous and piecewise
constant with jumps at boundaries[2], ..., boundaries[K+1].
Arguments
- q
Numeric vector of quantiles.
- 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).
Details
Below boundaries[1] the function returns 0. At
boundaries[i+1] (the right edge of bin i), F jumps by
pmf[i], so \(F(boundaries[i+1]) = \sum_{j=1}^{i} pmf_j\).
For q in \([boundaries[i], boundaries[i+1])\), F equals
\(\sum_{j=1}^{i-1} pmf_j\). At or above boundaries[K+1]
the function returns 1.
Use with fitdistdoublecens()
This function carries the attribute vector_param = "pmf" so that
fitdistdoublecens can drive it from a flat list of scalar
parameters p1, ..., p_{K-1}. The free parameters are the first
\(K-1\) bin probabilities; the last is set to
1 - sum(p1, ..., p_{K-1}). When the implied probabilities violate
the simplex (any negative entry, or sum departing from 1 by more than
\(10^{-8}\)), the function returns 0 (or near-zero density in
ddiscretestep) rather than erroring; this drives the
optimiser back to the feasible region.
See also
Other pdiscretestep:
ddiscretestep(),
hazards_to_pmf(),
pmf_to_hazards(),
rdiscretestep()
