Distributions.Censored
— TypeCensored
Generic wrapper for a censored
distribution.
From 2c8388a8d05e17a040518a4c0f99499dc5113899 Mon Sep 17 00:00:00 2001
From: "Documenter.jl"
where $f_{d_0}(x)$ is the probability density (mass) function of $d_0$.
If $Z \sim d_0$, and X = clamp(Z, l, u)
, then $X \sim d$. Note that this implies that even if $d_0$ is continuous, its censored form assigns positive probability to the bounds $l$ and $u$. Therefore, a censored continuous distribution has atoms and is a mixture of discrete and continuous components.
The function falls back to constructing a Distributions.Censored
wrapper.
Usage
censored(d0; lower=l) # d0 left-censored to the interval [l, Inf)
censored(d0; upper=u) # d0 right-censored to the interval (-Inf, u]
censored(d0; lower=l, upper=u) # d0 interval-censored to the interval [l, u]
-censored(d0, l, u) # d0 interval-censored to the interval [l, u]
Implementation
To implement a specialized censored form for distributions of type D
, instead of overloading a method with one of the above signatures, one or more of the following methods should be implemented:
censored(d0::D, l::T, u::T) where {T <: Real}
censored(d0::D, ::Nothing, u::Real)
censored(d0::D, l::Real, ::Nothing)
In the general case, this will create a Distributions.Censored{typeof(d0)}
structure, defined as follows:
Distributions.Censored
— TypeCensored
Generic wrapper for a censored
distribution.
In general, censored
should be called instead of the constructor of Censored
, which is not exported.
Many functions, including those for the evaluation of pdf and sampling, are defined for all censored univariate distributions:
maximum(::UnivariateDistribution)
minimum(::UnivariateDistribution)
insupport(::UnivariateDistribution, x::Any)
pdf(::UnivariateDistribution, ::Real)
logpdf(::UnivariateDistribution, ::Real)
cdf(::UnivariateDistribution, ::Real)
logcdf(::UnivariateDistribution, ::Real)
logdiffcdf(::UnivariateDistribution, ::T, ::T) where {T <: Real}
ccdf(::UnivariateDistribution, ::Real)
logccdf(::UnivariateDistribution, ::Real)
quantile(::UnivariateDistribution, ::Real)
cquantile(::UnivariateDistribution, ::Real)
invlogcdf(::UnivariateDistribution, ::Real)
invlogccdf(::UnivariateDistribution, ::Real)
median(::UnivariateDistribution)
rand(::UnivariateDistribution)
rand!(::UnivariateDistribution, ::AbstractArray)
Some functions to compute statistics are available for the censored distribution if they are also available for its truncation:
mean(::UnivariateDistribution)
var(::UnivariateDistribution)
std(::UnivariateDistribution)
entropy(::UnivariateDistribution)
For example, these functions are available for the following uncensored distributions:
DiscreteUniform
Exponential
LogUniform
Normal
Uniform
mode
is not implemented for censored distributions.
Settings
This document was generated with Documenter.jl version 0.27.25 on Monday 1 July 2024. Using Julia version 1.10.4.