Skip to contents

Package overview

distspec distspec-package
distspec: Define Probability Distributions with Certain or Uncertain Parameters

Defining probability distributions

Constructors for the supported probability distributions.

Distributions
Probability distributions
Gamma()
Gamma distribution
LogNormal()
Lognormal distribution
Normal()
Normal distribution
Exponential() Exp()
Exponential distribution
Weibull()
Weibull distribution
Beta()
Beta distribution
Fixed()
Fixed (point-mass) distribution
NonParametric()
Nonparametric distribution
Dirichlet()
Dirichlet prior for a nonparametric distribution
new_dist_spec()
Internal function for generating a dist_spec given parameters and a distribution.

Access properties

Extract the type, parameters or probability mass function of a distribution.

get_distribution()
Get the distribution of a <dist_spec>
get_parameters()
Get parameters of a parametric distribution
get_pmf()
Get the probability mass function of a nonparametric distribution
ndist()
Calculate the number of distributions in a <dist_spec>

Summarise distributions

Summary statistics of a distribution.

mean(<dist_spec>)
Returns the mean of one or more delay distribution
sd()
Returns the standard deviation of one or more delay distribution
max(<dist_spec>)
Returns the maximum of one or more delay distribution
is_constrained(<dist_spec>)
Check if a <dist_spec> is constrained, i.e. has a finite maximum or nonzero CDF cutoff.

Combine and modify distributions

Combine, convolve, discretise and fix the parameters of distributions.

c(<dist_spec>)
Combines multiple delay distributions for further processing
`+`(<dist_spec>)
Creates a delay distribution as the sum of two other delay distributions.
collapse(<dist_spec>)
Collapse nonparametric distributions in a <dist_spec>
discretise(<dist_spec>) discretize()
Discretise a <dist_spec>
bound_dist()
Define bounds of a <dist_spec>
fix_parameters(<dist_spec>)
Fix the parameters of a <dist_spec>

Sample from distributions

Draw random samples from a distribution with fixed parameters.

sample_dist()
Sample from a distribution

Compare distributions

`==`(<dist_spec>) `!=`(<dist_spec>)
Compares two delay distributions

Visualise distributions

Print or plot a distribution.

print(<dist_spec>)
Prints the parameters of one or more delay distributions
plot(<dist_spec>)
Plot PMF and CDF for a dist_spec object

Parameter helpers

Lower-level helpers for working with distribution parameters.

natural_params()
Get the names of the natural parameters of a distribution
lower_bounds()
Get the lower bounds of the parameters of a distribution
convert_to_logmean()
Convert mean and sd to log mean for a log normal distribution
convert_to_logsd()
Convert mean and sd to log standard deviation for a log normal distribution