Details
The constructor function CensoredLogistic sets up a distribution object, representing the censored logistic probability distribution by the corresponding parameters: the latent mean location = \(\mu\) and latent standard deviation scale = \(\sigma\) (i.e., the parameters of the underlying uncensored logistic variable), the left censoring point (with -Inf corresponding to uncensored), and the right censoring point (with Inf corresponding to uncensored).
The censored logistic distribution has probability density function (PDF) \(f(x)\):
|
\(\Lambda((left - \mu)/\sigma)\)
|
if \(x \le left\)
|
|
\(1 - \Lambda((right - \mu)/\sigma)\)
|
if \(x \ge right\)
|
|
\(\lambda((x - \mu)/\sigma)/\sigma\)
|
otherwise
|
where \(\Lambda\) and \(\lambda\) are the cumulative distribution function and probability density function of the standard logistic distribution, respectively.
All parameters can also be vectors, so that it is possible to define a vector of censored logistic distributions with potentially different parameters. All parameters need to have the same length or must be scalars (i.e., of length 1) which are then recycled to the length of the other parameters.
For the CensoredLogistic distribution objects there is a wide range of standard methods available to the generics provided in the distributions3 package: pdf and log_pdf for the (log-)density (PDF), cdf for the probability from the cumulative distribution function (CDF), quantile for quantiles, random for simulating random variables, crps for the continuous ranked probability score (CRPS), and support for the support interval (minimum and maximum). Internally, these methods rely on the usual d/p/q/r functions provided for the censored logistic distributions in the crch package, see dclogis, and the crps_clogis function from the scoringRules package. The methods is_discrete and is_continuous can be used to query whether the distributions are discrete on the entire support (always FALSE) or continuous on the entire support (only TRUE if there is no censoring, i.e., if both left and right are infinite).
See the examples below for an illustration of the workflow for the class and methods.