Internal Documentation
Documentation for CensoredDistributions.jl
's internal interface.
Contents
Index
Base.rand
Base.rand
Base.rand
Base.rand
CensoredDistributions._quantile_optimization
Distributions.cdf
Distributions.cdf
Distributions.cdf
Distributions.cdf
Distributions.logcdf
Distributions.logcdf
Distributions.logcdf
Distributions.logpdf
Distributions.logpdf
Distributions.logpdf
Distributions.logpdf
Distributions.pdf
Distributions.pdf
Distributions.pdf
Distributions.pdf
Statistics.mean
Statistics.median
Statistics.quantile
Statistics.quantile
Statistics.quantile
Statistics.quantile
Statistics.std
Statistics.var
Internal API
Base.rand
— Methodrand(
rng::Random.AbstractRNG,
d::CensoredDistributions.IntervalCensored
) -> Any
Generate a random sample by discretising a sample from the underlying distribution.
See also: quantile
Base.rand
— Methodrand(
rng::Random.AbstractRNG,
d::CensoredDistributions.PrimaryCensored
) -> Any
Generate a random sample by summing samples from delay and primary event distributions.
See also: quantile
Base.rand
— Methodrand(
rng::Random.AbstractRNG,
d::CensoredDistributions.Weighted
) -> Any
Generate a random sample (delegates to underlying distribution).
See also: quantile
Base.rand
— Methodrand(rng::Random.AbstractRNG, d::ExponentiallyTilted) -> Any
Generate a random sample using inverse transform sampling.
See also: quantile
CensoredDistributions._quantile_optimization
— Method_quantile_optimization(
d,
p::Real;
initial_guess_fn,
result_postprocess_fn,
check_nan
) -> Any
Internal function for quantile optimization using numerical methods.
Solves the equation cdf(d, q) - p = 0
using the Nelder-Mead algorithm. This is shared logic used by both PrimaryCensored
and IntervalCensored
quantile functions.
Arguments
d
: The distribution for which to compute the quantilep
: The probability value in[0, 1]
Keyword Arguments
initial_guess_fn
: Function that takes(d, p)
and returns initial guess vector. Ifnothing
, usesquantile(get_dist(d), p)
as scalar initial guess.result_postprocess_fn
: Function to post-process the optimization result. Defaults to identity (no post-processing).check_nan
: Iftrue
, explicitly check for NaN input values.
Returns
The quantile value after optimization and post-processing.
Implementation Details
- Validates that p ∈
[0, 1]
(with optional NaN checking) - Handles boundary cases p=0 (minimum) and p=1 (maximum) analytically
- Creates objective function
(cdf(d, q) - p)^2
with support checking - Uses heavy penalty for values outside distribution support
- Solves with Nelder-Mead algorithm with tight tolerances
- Checks convergence and applies post-processing to result
Type Stability
This function is designed to maintain type stability when the initial guess function and post-processing function are type-stable.
Distributions.cdf
— Methodcdf(
d::CensoredDistributions.IntervalCensored,
x::Real
) -> Any
Compute the cumulative distribution function.
See also: logcdf
Distributions.cdf
— Methodcdf(
d::CensoredDistributions.PrimaryCensored,
x::Real
) -> Any
Compute the cumulative distribution function.
See also: logcdf
Distributions.cdf
— Methodcdf(d::CensoredDistributions.Weighted, x::Real) -> Any
Compute the cumulative distribution function (delegates to underlying distribution).
See also: logcdf
Distributions.cdf
— Methodcdf(d::ExponentiallyTilted, x::Real) -> Any
Compute the cumulative distribution function.
Distributions.logcdf
— Methodlogcdf(
d::CensoredDistributions.IntervalCensored,
x::Real
) -> Any
Compute the log cumulative distribution function.
See also: cdf
Distributions.logcdf
— Methodlogcdf(
d::CensoredDistributions.PrimaryCensored,
x::Real
) -> Any
Compute the log cumulative distribution function.
See also: cdf
Distributions.logcdf
— Methodlogcdf(d::ExponentiallyTilted, x::Real) -> Any
Compute the log cumulative distribution function.
See also: cdf
Distributions.logpdf
— Methodlogpdf(
d::CensoredDistributions.IntervalCensored,
x::Real
) -> Any
Compute the log probability mass for the interval containing x
.
Distributions.logpdf
— Methodlogpdf(
d::CensoredDistributions.PrimaryCensored,
x::Real
) -> Any
Compute the log probability density function using numerical differentiation of the log CDF.
Distributions.logpdf
— Methodlogpdf(d::CensoredDistributions.Weighted, x::Real) -> Any
Return the weighted log-probability: weight * logpdf(dist, x)
.
See also: pdf
Distributions.logpdf
— Methodlogpdf(d::ExponentiallyTilted, x::Real) -> Any
Compute the log probability density function.
Distributions.pdf
— Methodpdf(
d::CensoredDistributions.IntervalCensored,
x::Real
) -> Any
Compute the probability mass for the interval containing x
.
Distributions.pdf
— Methodpdf(
d::CensoredDistributions.PrimaryCensored,
x::Real
) -> Any
Compute the probability density function using numerical differentiation.
See also: logpdf
Distributions.pdf
— Methodpdf(d::CensoredDistributions.Weighted, x::Real) -> Any
Return the probability density from the underlying distribution (unweighted).
See also: logpdf
Distributions.pdf
— Methodpdf(d::ExponentiallyTilted, x::Real) -> Any
Compute the probability density function.
See also: logpdf
Statistics.mean
— MethodStatistics.median
— Methodmedian(d::ExponentiallyTilted) -> Any
Compute the median of the distribution.
Statistics.quantile
— Methodquantile(
d::CensoredDistributions.IntervalCensored,
p::Real
) -> Any
Compute the quantile using numerical optimization.
The returned quantile respects the interval structure:
- For regular intervals: quantiles are multiples of the interval width
- For arbitrary intervals: quantiles correspond to interval boundary values
See also: cdf
Statistics.quantile
— Methodquantile(
d::CensoredDistributions.PrimaryCensored,
p::Real
) -> Any
Compute the quantile (inverse CDF) using numerical optimization.
See also: cdf
Statistics.quantile
— Methodquantile(d::CensoredDistributions.Weighted, p::Real) -> Any
Compute the quantile function (delegates to underlying distribution).
See also: cdf
Statistics.quantile
— Methodquantile(d::ExponentiallyTilted, p::Real) -> Any
Compute the quantile function (inverse CDF) using analytical formula.
See also: cdf
Statistics.std
— Methodstd(d::ExponentiallyTilted) -> Any
Compute the standard deviation of the distribution.
Statistics.var
— Method