Internal Documentation

Documentation for CensoredDistributions.jl's internal interface.

Contents

Index

Internal API

Base.randMethod
rand(
    rng::Random.AbstractRNG,
    d::CensoredDistributions.IntervalCensored
) -> Any

Generate a random sample by discretising a sample from the underlying distribution.

See also: quantile

source
Base.randMethod
rand(
    rng::Random.AbstractRNG,
    d::CensoredDistributions.PrimaryCensored
) -> Any

Generate a random sample by summing samples from delay and primary event distributions.

See also: quantile

source
Base.randMethod
rand(
    rng::Random.AbstractRNG,
    d::CensoredDistributions.Weighted
) -> Any

Generate a random sample (delegates to underlying distribution).

See also: quantile

source
Base.randMethod
rand(rng::Random.AbstractRNG, d::ExponentiallyTilted) -> Any

Generate a random sample using inverse transform sampling.

See also: quantile

source
CensoredDistributions._quantile_optimizationMethod
_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 quantile
  • p: The probability value in [0, 1]

Keyword Arguments

  • initial_guess_fn: Function that takes (d, p) and returns initial guess vector. If nothing, uses quantile(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: If true, 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.

source
Distributions.cdfMethod
cdf(
    d::CensoredDistributions.IntervalCensored,
    x::Real
) -> Any

Compute the cumulative distribution function.

See also: logcdf

source
Distributions.cdfMethod
cdf(
    d::CensoredDistributions.PrimaryCensored,
    x::Real
) -> Any

Compute the cumulative distribution function.

See also: logcdf

source
Distributions.cdfMethod
cdf(d::CensoredDistributions.Weighted, x::Real) -> Any

Compute the cumulative distribution function (delegates to underlying distribution).

See also: logcdf

source
Distributions.logcdfMethod
logcdf(
    d::CensoredDistributions.IntervalCensored,
    x::Real
) -> Any

Compute the log cumulative distribution function.

See also: cdf

source
Distributions.logcdfMethod
logcdf(
    d::CensoredDistributions.PrimaryCensored,
    x::Real
) -> Any

Compute the log cumulative distribution function.

See also: cdf

source
Distributions.logcdfMethod
logcdf(d::ExponentiallyTilted, x::Real) -> Any

Compute the log cumulative distribution function.

See also: cdf

source
Distributions.logpdfMethod
logpdf(
    d::CensoredDistributions.IntervalCensored,
    x::Real
) -> Any

Compute the log probability mass for the interval containing x.

See also: pdf, logcdf

source
Distributions.logpdfMethod
logpdf(
    d::CensoredDistributions.PrimaryCensored,
    x::Real
) -> Any

Compute the log probability density function using numerical differentiation of the log CDF.

See also: pdf, logcdf

source
Distributions.logpdfMethod
logpdf(d::CensoredDistributions.Weighted, x::Real) -> Any

Return the weighted log-probability: weight * logpdf(dist, x).

See also: pdf

source
Distributions.pdfMethod
pdf(
    d::CensoredDistributions.IntervalCensored,
    x::Real
) -> Any

Compute the probability mass for the interval containing x.

See also: logpdf, cdf

source
Distributions.pdfMethod
pdf(
    d::CensoredDistributions.PrimaryCensored,
    x::Real
) -> Any

Compute the probability density function using numerical differentiation.

See also: logpdf

source
Distributions.pdfMethod
pdf(d::CensoredDistributions.Weighted, x::Real) -> Any

Return the probability density from the underlying distribution (unweighted).

See also: logpdf

source
Statistics.quantileMethod
quantile(
    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

source
Statistics.quantileMethod
quantile(
    d::CensoredDistributions.PrimaryCensored,
    p::Real
) -> Any

Compute the quantile (inverse CDF) using numerical optimization.

See also: cdf

source
Statistics.quantileMethod
quantile(d::CensoredDistributions.Weighted, p::Real) -> Any

Compute the quantile function (delegates to underlying distribution).

See also: cdf

source
Statistics.quantileMethod
quantile(d::ExponentiallyTilted, p::Real) -> Any

Compute the quantile function (inverse CDF) using analytical formula.

See also: cdf

source
Statistics.stdMethod
std(d::ExponentiallyTilted) -> Any

Compute the standard deviation of the distribution.

See also: mean, var

source