### Setup Environment for Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Import necessary packages and set the random seed for reproducible results when working with distributions. ```julia using Random, Distributions Random.seed!(123); # Setting the seed ``` -------------------------------- ### Install R Dependencies Source: https://github.com/juliastats/distributions.jl/blob/master/test/ref/readme.md Install R package dependencies using renv. Run this command within the R environment in the project's root directory. ```r renv::restore() ``` -------------------------------- ### Get Distribution Parameters Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Retrieve the names of the parameters used to initialize a specific distribution. This helps in understanding how to construct distribution objects. ```julia fieldnames(Cauchy) ``` -------------------------------- ### Check Distributions.jl Package Status Source: https://github.com/juliastats/distributions.jl/blob/master/README.md Use this command in the Julia REPL to get the current version of the Distributions package. This is useful for reporting bugs. ```julia julia> ]status Distributions ``` -------------------------------- ### Plot Density of Triweight Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of a Triweight distribution with specified parameters. This is an example of plotting a continuous distribution. ```julia plotdensity((0, 2), Triweight, (1, 1)) # hide ``` -------------------------------- ### Plot Density of Weibull Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of a Weibull distribution with specified parameters. This is an example of plotting a continuous distribution. ```julia plotdensity((0.001, 3), Weibull, (0.5, 1)) # hide ``` -------------------------------- ### Plot Density of TDist Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of a TDist with specified parameters. This is an example of plotting a continuous distribution. ```julia plotdensity((-5, 5), TDist, (5,)) # hide ``` -------------------------------- ### Instantiate Docs Project Source: https://github.com/juliastats/distributions.jl/blob/master/README.md Instantiate the docs project for Distributions.jl. This is a prerequisite for building the documentation locally. ```julia julia --project=docs/ pkg> instantiate ``` -------------------------------- ### Build Local Documentation Source: https://github.com/juliastats/distributions.jl/blob/master/README.md Build the documentation for Distributions.jl locally. This command should be run after setting up the development environment. ```julia julia --project=docs/ docs/make.jl ``` -------------------------------- ### Implement Sampler Method for Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/extends.md Most distributions should implement a `sampler` method to enhance the efficiency of batch sampling operations. ```julia sampler(d::Distribution) ``` -------------------------------- ### Sufficient Statistics Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md This section describes how to compute sufficient statistics from a dataset and then use them to fit a distribution. ```APIDOC ## `suffstats(D, x)` and `suffstats(D, x, w)` ### Description Computes the sufficient statistics for a distribution of type `D` from a dataset `x`, optionally with weights `w`. ### Method `suffstats` ### Parameters #### Path Parameters - **D** (Type) - Required - The type of the distribution. - **x** (Array) - Required - The dataset (array of samples). - **w** (Array, Optional) - The weights for each sample in `x`. ### Response #### Success Response (Sufficient Statistics object) - Returns an object capturing the sufficient statistics. ### Response Example ```julia # Example for Normal distribution (mean and variance) ss = suffstats(Normal, [1.0, 2.0, 3.0, 4.0, 5.0]) ``` ## `fit_mle(D, ss)` ### Description Performs maximum likelihood estimation for a distribution of type `D` based on pre-computed sufficient statistics `ss`. ### Method `fit_mle` ### Parameters #### Path Parameters - **D** (Type) - Required - The type of the distribution. - **ss** (Sufficient Statistics object) - Required - The sufficient statistics object. ### Response #### Success Response (Distribution object) - Returns an instance of the fitted distribution `D`. ### Response Example ```julia # Assuming 'ss' is a sufficient statistics object for Normal distribution d = fit_mle(Normal, ss) ``` ``` -------------------------------- ### NamedTuple-variate Product Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/product.md Constructs a product distribution from a NamedTuple of distributions. ```APIDOC ## NamedTuple-variate Product Distributions ### Description Constructs a product distribution from a NamedTuple of distributions. ### Method - `Distributions.product_distribution(::NamedTuple{<:Any,<:Tuple{Distribution,Vararg{Distribution}}}) ### Type - `Distributions.ProductNamedTupleDistribution` ``` -------------------------------- ### Common Interface for Matrix Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/matrix.md Lists the common methods implemented by all matrix-variate distributions, such as size, length, rank, mean, variance, covariance, and probability density functions. ```julia size(::MatrixDistribution) length(::MatrixDistribution) Distributions.rank(::MatrixDistribution) mean(::MatrixDistribution) var(::MatrixDistribution) cov(::MatrixDistribution) pdf(d::MatrixDistribution, x::AbstractMatrix{<:Real}) logpdf(d::MatrixDistribution, x::AbstractMatrix{<:Real}) Distributions._rand!(::AbstractRNG, ::MatrixDistribution, A::AbstractMatrix) ``` -------------------------------- ### Internal Methods for Creating Matrix-variate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/matrix.md Provides access to internal methods, primarily intended for developers who wish to create their own custom matrix-variate distributions. ```APIDOC ## Internal Methods (for creating your own matrix-variate distributions) ```julia Distributions._logpdf(d::MatrixDistribution, x::AbstractMatrix{<:Real}) ``` ``` -------------------------------- ### Available Matrix-variate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/matrix.md Lists the specific matrix-variate distributions available in the package, including MatrixNormal, Wishart, InverseWishart, MatrixTDist, MatrixBeta, MatrixFDist, and LKJ. ```julia MatrixNormal Wishart InverseWishart MatrixTDist MatrixBeta MatrixFDist LKJ ``` -------------------------------- ### Develop Distributions.jl Locally Source: https://github.com/juliastats/distributions.jl/blob/master/README.md Develop the Distributions.jl package locally. This command should be run after instantiating the docs project. ```julia pkg> dev . ``` -------------------------------- ### Define Other Distribution Types Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Illustrates how to define various types of distributions including discrete, continuous, univariate, multivariate, and matrix-variate distributions. ```julia Binomial(n, p) # Discrete univariate ``` ```julia Cauchy(u, b) # Continuous univariate ``` ```julia Multinomial(n, p) # Discrete multivariate ``` ```julia Wishart(nu, S) # Continuous matrix-variate ``` -------------------------------- ### Implement Univariate Sampler Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/extends.md To implement a univariate sampler, define a subtype of `Sampleable{Univariate,S}` and provide a `rand` method for generating a single sample. ```julia function rand(rng::AbstractRNG, s::Spl) # ... generate a single sample from s end ``` -------------------------------- ### Construct Mixture of Normal Distributions with Prior Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Constructs a mixture of three univariate normal distributions with specified prior probabilities. Ensure the component distributions and prior probabilities are provided in the correct order. ```julia MixtureModel(Normal[Normal(-2.0, 1.2), Normal(0.0, 1.0), Normal(3.0, 2.5)], [0.2, 0.5, 0.3]) ``` -------------------------------- ### Implement Matrix-variate Sampler Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/extends.md To implement a matrix-variate sampler, define a subtype of `Sampleable{Multivariate,S}` and implement `size` and `_rand!` methods for generating matrix samples. ```julia Base.size(s::Spl) = ... # the size of each matrix sample function _rand!(rng::AbstractRNG, s::Spl, x::DenseMatrix{T}) where T<:Real # ... generate a single matrix sample to x end ``` -------------------------------- ### MvLogNormal Specific Methods Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Lists methods specific to the `MvLogNormal` distribution, including functions to retrieve its location, scale, median, and mode. It also provides functions to calculate the location and scale parameters from mean and covariance, or median/mode, which is useful for parameter transformations. ```julia location(::MvLogNormal) scale(::MvLogNormal) median(::MvLogNormal) mode(::MvLogNormal) ``` ```julia location{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix) location!{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix,μ::AbstractVector) scale{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix) scale!{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix,Σ::AbstractMatrix) params{D<:Distributions.AbstractMvLogNormal}(::Type{D},m::AbstractVector,S::AbstractMatrix) ``` -------------------------------- ### Retrieve Distribution Parameters Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Provides methods to retrieve various parameters of univariate distributions. Not all methods are defined for all distributions. ```julia params(::UnivariateDistribution) scale(::UnivariateDistribution) location(::UnivariateDistribution) shape(::UnivariateDistribution) rate(::UnivariateDistribution) ncategoriess(::UnivariateDistribution) ntrials(::UnivariateDistribution) dof(::UnivariateDistribution) ``` -------------------------------- ### Uniform Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Documentation for the Uniform distribution. ```APIDOC ## Uniform ### Description Documentation for the Uniform distribution. ### Example ```julia plotdensity((-0.5, 1.5), Uniform, (0, 1); ylim=(0, 1.5)) ``` ``` -------------------------------- ### Efficient Batch Sampling for Multivariate Samplers Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/extends.md If a more efficient method exists for generating multiple vector samples in a batch, provide an optimized `_rand!` method that accepts a `DenseMatrix`. ```julia function _rand!(rng::AbstractRNG, s::Spl, A::DenseMatrix{T}) where T<:Real # ... generate multiple vector samples in batch end ``` -------------------------------- ### Construct Mixture with Parameter Tuples and Prior Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Constructs a mixture model using tuples of parameters for the component distributions and an explicit prior probability vector. This syntax simplifies component definition when they share the same type. ```julia MixtureModel(Normal, [(-2.0, 1.2), (0.0, 1.0), (3.0, 2.5)], [0.2, 0.5, 0.3]) ``` -------------------------------- ### Additional Methods for AbstractMvNormal Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Extended methods available for distributions inheriting from AbstractMvNormal. ```APIDOC ## Addition Methods ### AbstractMvNormal In addition to the methods listed in the common interface above, we also provide the following methods for all multivariate distributions under the base type `AbstractMvNormal`: ### `invcov(::Distributions.AbstractMvNormal)` Computes the inverse of the covariance matrix. ### `logdetcov(::Distributions.AbstractMvNormal)` Computes the logarithm of the determinant of the covariance matrix. ### `sqmahal(::Distributions.AbstractMvNormal, ::AbstractArray)` Computes the squared Mahalanobis distance. ### `rand(::AbstractRNG, ::Distributions.AbstractMvNormal)` Generates a random sample from the distribution. ### `minimum(::Distributions.AbstractMvNormal)` Returns the minimum value in the support of the distribution. ### `maximum(::Distributions.AbstractMvNormal)` Returns the maximum value in the support of the distribution. ### `extrema(::Distributions.AbstractMvNormal)` Returns the minimum and maximum values in the support of the distribution. ``` -------------------------------- ### AbstractMvNormal Additional Methods Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Provides additional methods specific to distributions inheriting from `AbstractMvNormal`. These include calculations related to the covariance matrix such as its inverse and log-determinant, squared Mahalanobis distance, and sampling. It also includes methods for finding the minimum, maximum, and extrema of the distribution's support. ```julia invcov(::Distributions.AbstractMvNormal) logdetcov(::Distributions.AbstractMvNormal) sqmahal(::Distributions.AbstractMvNormal, ::AbstractArray) rand(::AbstractRNG, ::Distributions.AbstractMvNormal) minimum(::Distributions.AbstractMvNormal) maximum(::Distributions.AbstractMvNormal) extrema(::Distributions.AbstractMvNormal) ``` -------------------------------- ### Common Interface Methods Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Provides access to the components, their prior probabilities, and the type of the component distributions for any mixture model. ```APIDOC ## Common Interface ```julia components(::AbstractMixtureModel) probs(::AbstractMixtureModel) Distributions.component_type(::AbstractMixtureModel) ``` ### Description These methods allow you to retrieve the individual component distributions, their associated prior probabilities, and the type of the component distributions from a mixture model. ### Examples ```julia # Assuming `mm` is an instance of MixtureModel comps = components(mm) priors = probs(mm) comp_type = Distributions.component_type(mm) ``` ``` -------------------------------- ### Multivariate Product Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/product.md Constructs a product distribution from an array of distributions or a vector of Normal distributions. ```APIDOC ## Multivariate Product Distributions ### Description Constructs a product distribution from an array of distributions or a vector of Normal distributions. ### Methods - `Distributions.product_distribution(::AbstractArray{<:Distribution{<:ArrayLikeVariate}}) - `Distributions.product_distribution(::AbstractVector{<:Normal}) ### Types - `Distributions.ProductDistribution` - `Distributions.Product` ``` -------------------------------- ### Retrieve Success and Failure Probabilities Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Defines methods for success and failure probabilities, applicable to discrete distributions where these concepts are meaningful. ```julia succprob(::DiscreteUnivariateDistribution) failprob(::DiscreteUnivariateDistribution) ``` -------------------------------- ### Create and Inspect Standard Normal Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Create a standard-normal distribution object and query its mean. This is useful for understanding the basic properties of a distribution. ```julia d = Normal() mean(d) ``` -------------------------------- ### Internal Method for Creating Matrix-variate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/matrix.md Details the internal method `_logpdf` used for creating custom matrix-variate distributions. ```julia Distributions._logpdf(d::MatrixDistribution, x::AbstractMatrix{<:Real}) ``` -------------------------------- ### Specific Matrix-variate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/matrix.md This section lists the available specific matrix-variate distributions implemented in the package. ```APIDOC ## Distributions ```julia MatrixNormal Wishart InverseWishart MatrixTDist MatrixBeta MatrixFDist LKJ ``` ``` -------------------------------- ### Multivariate Distribution Common Interface Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Lists common methods for multivariate distributions, including computation of statistics like length, size, mean, variance, standard deviation, covariance, correlation, and entropy. These methods provide a consistent way to interact with any multivariate distribution. ```julia length(::MultivariateDistribution) size(::MultivariateDistribution) eltype(::Type{MultivariateDistribution}) mean(::MultivariateDistribution) var(::MultivariateDistribution) std(::MultivariateDistribution) cov(::MultivariateDistribution) cor(::MultivariateDistribution) entropy(::MultivariateDistribution) entropy(::MultivariateDistribution, ::Real) ``` -------------------------------- ### Common Interface for Matrix Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/matrix.md All matrix-variate distributions implement a common set of methods for size, length, rank, mean, variance, covariance, probability density function (pdf), log probability density function (logpdf), and random number generation. ```APIDOC ## Common Interface All distributions implement the same set of methods: ```julia size(::MatrixDistribution) length(::MatrixDistribution) Distributions.rank(::MatrixDistribution) mean(::MatrixDistribution) var(::MatrixDistribution) cov(::MatrixDistribution) pdf(d::MatrixDistribution, x::AbstractMatrix{<:Real}) logpdf(d::MatrixDistribution, x::AbstractMatrix{<:Real}) Distributions._rand!(::AbstractRNG, ::MatrixDistribution, A::AbstractMatrix) ``` ``` -------------------------------- ### Evaluate Univariate Distribution Probabilities Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Provides functions for probability evaluation, including checking if a value is within the support, calculating PDF, log-PDF, CDF, log-CDF, and quantiles. ```julia insupport(::UnivariateDistribution, x::Any) pdf(::UnivariateDistribution, ::Real) logpdf(::UnivariateDistribution, ::Real) gradlogpdf(::ContinuousUnivariateDistribution, ::Real) loglikelihood(::UnivariateDistribution, ::AbstractArray) cdf(::UnivariateDistribution, ::Real) logcdf(::UnivariateDistribution, ::Real) logdiffcdf(::UnivariateDistribution, ::Real, ::Real) ccdf(::UnivariateDistribution, ::Real) logccdf(::UnivariateDistribution, ::Real) quantile(::UnivariateDistribution, ::Real) cquantile(::UnivariateDistribution, ::Real) invlogcdf(::UnivariateDistribution, ::Real) invlogccdf(::UnivariateDistribution, ::Real) ``` -------------------------------- ### Weibull Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Documentation for the Weibull distribution. ```APIDOC ## Weibull ### Description Documentation for the Weibull distribution. ### Example ```julia plotdensity((0.001, 3), Weibull, (0.5, 1)) ``` ``` -------------------------------- ### Generic Methods for Univariate and Multivariate Mixtures Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Provides common statistical functions like mean, variance, length, probability density, log-probability density, and random sampling for univariate and multivariate mixture models. ```APIDOC ## Generic Methods ```julia mean(::AbstractMixtureModel) var(::UnivariateMixture) length(::MultivariateMixture) pdf(::AbstractMixtureModel, x) logpdf(::AbstractMixtureModel, x) rand(::AbstractMixtureModel) rand!(::AbstractMixtureModel, ::AbstractArray) ``` ### Description These generic methods are available for univariate and multivariate mixture models, providing functionalities to calculate the mean, variance, length, probability density, log-probability density, and to generate random samples from the mixture distribution. ### Examples ```julia # Assuming `mm` is an instance of UnivariateMixture or MultivariateMixture model_mean = mean(mm) model_var = var(mm) # For UnivariateMixture num_components = length(mm) # For MultivariateMixture probability = pdf(mm, value) log_probability = logpdf(mm, value) random_sample = rand(mm) ``` ``` -------------------------------- ### Sampling from Multivariate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Methods for generating random samples from multivariate distributions. ```APIDOC ## Sampling ### `rand(rng::AbstractRNG, ::MultivariateDistribution)` Generates a random sample from the distribution using the provided random number generator. ### `rand!(rng::AbstractRNG, d::MultivariateDistribution, x::AbstractArray)` Fills a pre-allocated array with random samples from the distribution. ``` -------------------------------- ### Generate Reference Data Source: https://github.com/juliastats/distributions.jl/blob/master/test/ref/readme.md Execute the R script to generate reference data files. Navigate to the directory containing gendref.R in your terminal before running. ```shell Rscript gendref.R ``` -------------------------------- ### Implement Multivariate Sampler Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/extends.md For multivariate samplers, define a subtype of `Sampleable{Multivariate,S}` and implement `length` and `_rand!` methods for generating vector samples. ```julia Base.length(s::Spl) = ... # return the length of each sample function _rand!(rng::AbstractRNG, s::Spl, x::AbstractVector{T}) where T<:Real # ... generate a single vector sample to x end ``` -------------------------------- ### Construct Mixture with Parameter Tuples (Implicit Prior) Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Constructs a mixture model using parameter tuples for components, omitting the prior vector to imply equal prior probabilities for all components. This is a concise way to define mixtures with uniform priors. ```julia MixtureModel(Normal, [(-2.0, 1.2), (0.0, 1.0), (3.0, 2.5)]) ``` -------------------------------- ### Additional Methods for MvLogNormal Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Specific methods for the MvLogNormal distribution. ```APIDOC ### MvLogNormal In addition to the methods listed in the common interface above, we also provide the following methods: ### `location(::MvLogNormal)` Returns the location vector of the log-normal distribution. ### `scale(::MvLogNormal)` Returns the scale matrix of the log-normal distribution. ### `median(::MvLogNormal)` Computes the median of the log-normal distribution. ### `mode(::MvLogNormal)` Computes the mode of the log-normal distribution. It can be necessary to calculate the parameters of the lognormal (location vector and scale matrix) from a given covariance and mean, median or mode. To that end, the following functions are provided. ### `location{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix)` Calculates the location parameter for a log-normal distribution type. ### `location!{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix,μ::AbstractVector)` In-place version of `location`. ### `scale{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix)` Calculates the scale parameter for a log-normal distribution type. ### `scale!{D<:Distributions.AbstractMvLogNormal}(::Type{D},s::Symbol,m::AbstractVector,S::AbstractMatrix,Σ::AbstractMatrix)` In-place version of `scale`. ### `params{D<:Distributions.AbstractMvLogNormal}(::Type{D},m::AbstractVector,S::AbstractMatrix)` Calculates the parameters (location and scale) for a log-normal distribution type. ``` -------------------------------- ### Detect Method Ambiguities Source: https://github.com/juliastats/distributions.jl/blob/master/README.md Run this command at the end of the tests to check for method ambiguities introduced by your modifications. This helps maintain code quality. ```julia Test.detect_ambiguities(Distributions) ``` -------------------------------- ### Plot Density of Continuous Univariate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md A helper function to plot the probability density function of continuous univariate distributions. Requires Distributions and GR packages. ```julia using Distributions, GR GR.inline("svg") function plotdensity( (xmin, xmax), dist::ContinuousUnivariateDistribution; npoints=299, title="", kwargs... ) figure(; title=title, xlabel="x", ylabel="density", grid=false, backgroundcolor=0, # white instead of transparent background for dark Documenter scheme font="Helvetica_Regular", # work around https://github.com/JuliaPlots/Plots.jl/issues/2596 linewidth=2.0, # thick lines kwargs... ) return plot(range(xmin, xmax; length=npoints), Base.Fix1(pdf, dist)) end ``` -------------------------------- ### Sampling (Random number generation) Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Functions for generating random numbers from univariate distributions. ```APIDOC ## Sampling (Random number generation) ```julia rand(::AbstractRNG, ::UnivariateDistribution) rand!(::AbstractRNG, ::UnivariateDistribution, ::AbstractArray) ``` ``` -------------------------------- ### TriangularDist Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Documentation for the Triangular distribution. ```APIDOC ## TriangularDist ### Description Documentation for the Triangular distribution. ### Example ```julia plotdensity((-0.5, 2), TriangularDist, (0, 1.5, 0.5); npoints=6) ``` ``` -------------------------------- ### Create Censored Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/censored.md Use the `censored` function to create a censored version of a given distribution. This is the recommended way to construct censored distributions. ```julia censored ``` -------------------------------- ### Multivariate Distribution Sampling Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Details methods for sampling from multivariate distributions. Includes functions for generating random variates and efficiently filling pre-allocated arrays with samples. These are essential for Monte Carlo simulations and statistical analysis. ```julia rand(rng::AbstractRNG, ::MultivariateDistribution) rand!(rng::AbstractRNG, d::MultivariateDistribution, x::AbstractArray) ``` -------------------------------- ### Plot Density for BetaPrime Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Beta Prime distribution. Requires specifying the range and shape parameters. ```julia plotdensity((0, 1), BetaPrime, (1, 2)) # hide ``` -------------------------------- ### Multivariate Distribution Probability Evaluation Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Covers methods for probability evaluation in multivariate distributions, such as checking if a point is within the support, calculating the probability density function (pdf), and the log-probability density function (logpdf). It is generally advisable to use log scale for probability computations due to potential numerical issues with very small or large pdf values. ```julia insupport(::MultivariateDistribution, ::AbstractArray) pdf(::MultivariateDistribution, ::AbstractArray) logpdf(::MultivariateDistribution, ::AbstractArray) loglikelihood(::MultivariateDistribution, ::AbstractVector{<:Real}) ``` -------------------------------- ### Construct Mixture of Normal Distributions (Implicit Prior) Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Constructs a mixture of normal distributions where the prior probabilities are assumed to be equal, as the prior vector is omitted. This is suitable when all components have the same weight. ```julia MixtureModel(Normal[Normal(-2.0, 1.2), Normal(0.0, 1.0), Normal(3.0, 2.5)]) ``` -------------------------------- ### MixtureModel Constructors Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/mixture.md Constructs a mixture model by providing a vector of component distributions and an optional prior probability vector. If the prior vector is omitted, components are assumed to have equal prior probabilities. ```APIDOC ## Constructors ```julia MixtureModel(components::Vector{<:Distribution}, prior::Categorical) MixtureModel(components::Vector{<:Distribution}) MixtureModel{VF,VS,Component}(components::Vector{Component}, prior::Categorical) MixtureModel{VF,VS,Component}(components::Vector{Component}) ``` ### Description Constructs a mixture model from a vector of component distributions and an optional prior distribution. If the prior is omitted, it is assumed to be a uniform categorical distribution over the components. ### Examples ```julia # Mixture of three normal distributions with specified prior probabilities MixtureModel(Normal[Normal(-2.0, 1.2), Normal(0.0, 1.0), Normal(3.0, 2.5)], Categorical([0.2, 0.5, 0.3])) # Mixture of three normal distributions with equal prior probabilities MixtureModel(Normal[Normal(-2.0, 1.2), Normal(0.0, 1.0), Normal(3.0, 2.5)]) # Simplified syntax when component types are known and priors are equal MixtureModel(Normal, [(-2.0, 1.2), (0.0, 1.0), (3.0, 2.5)]) # Gaussian mixture with unit variance components MixtureModel(map(u -> Normal(u, 1.0), [-2.0, 0.0, 3.0])) ``` ``` -------------------------------- ### Sample from a Normal Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Generate random samples from a specified normal distribution. This is useful for simulations or creating test data. ```julia x = rand(d, 100) ``` ```julia rand(Normal(1, 2), 100) ``` -------------------------------- ### VonMises Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Documentation for the Von Mises distribution. ```APIDOC ## VonMises ### Description Documentation for the Von Mises distribution. ### Example ```julia plotdensity((-π, π), VonMises, (0.5,); xlim=(-π, π), xticks=(π/5, 5), xticklabels=x -> x ≈ -π ? "-π" : (x ≈ π ? "π" : "0")) ``` ``` -------------------------------- ### Plot Density for Johnson SU Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Johnson SU distribution. Requires specifying the range and parameters. ```julia plotdensity((-20, 20), JohnsonSU, (0.0, 1.0, 0.0, 1.0)) # hide ``` -------------------------------- ### Plot Density for Generalized Extreme Value Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Generalized Extreme Value distribution. Requires specifying the range and shape/scale/location parameters. ```julia plotdensity((0, 30), GeneralizedExtremeValue, (0, 1, 1)) # hide ``` -------------------------------- ### Plot Density for LogUniform Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Log-Uniform distribution. Requires specifying the range and parameters. ```julia plotdensity((0, 11), LogUniform, (1, 10)) # hide ``` -------------------------------- ### Plot Density for Skewed Exponential Power Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Skewed Exponential Power distribution. Requires specifying the range and parameters. ```julia plotdensity((-8, 5), SkewedExponentialPower, (0, 1, 0.7, 0.7)) # hide ``` -------------------------------- ### Parameter Retrieval Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Methods for retrieving parameters of univariate distributions. Some methods are distribution-specific. ```APIDOC ## Parameter Retrieval **Note:** `params` are defined for all univariate distributions, while other parameter retrieval methods are only defined for those distributions for which these parameters make sense. See below for details. ```julia params(::UnivariateDistribution) scale(::UnivariateDistribution) location(::UnivariateDistribution) shape(::UnivariateDistribution) rate(::UnivariateDistribution) ncategoriess(::UnivariateDistribution) ntrials(::UnivariateDistribution) dof(::UnivariateDistribution) ``` For distributions for which success and failure have a meaning, the following methods are defined: ```julia succprob(::DiscreteUnivariateDistribution) failprob(::DiscreteUnivariateDistribution) ``` ``` -------------------------------- ### Distribution Type Aliases Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/types.md Introduces type aliases for common combinations of variate forms and value supports to simplify practical usage of distributions. ```julia const UnivariateDistribution{S<:ValueSupport} = Distribution{Univariate,S} const MultivariateDistribution{S<:ValueSupport} = Distribution{Multivariate,S} const MatrixDistribution{S<:ValueSupport} = Distribution{Matrixvariate,S} const NonMatrixDistribution = Union{UnivariateDistribution, MultivariateDistribution} const DiscreteDistribution{F<:VariateForm} = Distribution{F,Discrete} const ContinuousDistribution{F<:VariateForm} = Distribution{F,Continuous} const DiscreteUnivariateDistribution = Distribution{Univariate, Discrete} const ContinuousUnivariateDistribution = Distribution{Univariate, Continuous} const DiscreteMultivariateDistribution = Distribution{Multivariate, Discrete} const ContinuousMultivariateDistribution = Distribution{Multivariate, Continuous} const DiscreteMatrixDistribution = Distribution{Matrixvariate, Discrete} const ContinuousMatrixDistribution = Distribution{Matrixvariate, Continuous} ``` -------------------------------- ### Plot Density for Kolmogorov Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Kolmogorov distribution. Requires specifying the range. ```julia plotdensity((0, 2), Kolmogorov) # hide ``` -------------------------------- ### Internal Method for Log-PDF Calculation Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Defines the internal method `_logpdf` for calculating the log-probability density function of a multivariate distribution. This is primarily intended for users who are creating their own custom multivariate distribution types. ```julia Distributions._logpdf(d::MultivariateDistribution, x::AbstractArray) ``` -------------------------------- ### Plot Density for Frechet Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Frechet distribution. Requires specifying the range and shape parameters. ```julia plotdensity((0, 20), Frechet, (1, 1)) # hide ``` -------------------------------- ### Discrete Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Documentation for various discrete probability distributions. ```APIDOC ## Discrete Distributions ### Bernoulli ### BernoulliLogit ### BetaBinomial ### Binomial ### Categorical ### Dirac ### DiscreteUniform ### DiscreteNonParametric ### Geometric ### Hypergeometric ### NegativeBinomial ### Poisson ### PoissonBinomial ### Skellam ### Soliton ``` -------------------------------- ### Triweight Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Documentation for the Triweight distribution. ```APIDOC ## Triweight ### Description Documentation for the Triweight distribution. ### Example ```julia plotdensity((0, 2), Triweight, (1, 1)) ``` ``` -------------------------------- ### Probability Evaluation for Multivariate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md Methods for evaluating probability density functions and related quantities. ```APIDOC ## Probability Evaluation ### `insupport(::MultivariateDistribution, ::AbstractArray)` Checks if a given vector is within the support of the distribution. ### `pdf(::MultivariateDistribution, ::AbstractArray)` Computes the probability density function (PDF) at a given point. ### `logpdf(::MultivariateDistribution, ::AbstractArray)` Computes the logarithm of the probability density function (log-PDF) at a given point. ### `loglikelihood(::MultivariateDistribution, ::AbstractVector{<:Real})` Computes the log-likelihood of a single observation. **Note:** For multivariate distributions, the pdf value is usually very small or large, and therefore direct evaluation of the pdf may cause numerical problems. It is generally advisable to perform probability computation in log scale. ``` -------------------------------- ### Plot Density for Erlang Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Erlang distribution. Requires specifying the range and shape/scale parameters. ```julia plotdensity((0, 8), Erlang, (7, 0.5)) # hide ``` -------------------------------- ### Plot Density for Beta Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Beta distribution. Requires specifying the range and shape parameters. ```julia plotdensity((0, 1), Beta, (2, 2)) # hide ``` -------------------------------- ### Fit Binomial Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md Fit a Binomial distribution using the number of trials `n` and the observed data `x`. Supports weighted data. ```julia fit_mle(Binomial, n, x) ``` ```julia fit_mle(Binomial, n, x, w) ``` -------------------------------- ### Compute Univariate Distribution Statistics Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Lists common statistical computations available for univariate distributions, including moments, measures of spread, and shape. ```julia maximum(::UnivariateDistribution) minimum(::UnivariateDistribution) extrema(::UnivariateDistribution) mean(::UnivariateDistribution) var(::UnivariateDistribution) std(::UnivariateDistribution) median(::UnivariateDistribution) modes(::UnivariateDistribution) mode(::UnivariateDistribution) skewness(::UnivariateDistribution) kurtosis(::UnivariateDistribution) kurtosis(::Distribution, ::Bool) isplatykurtic(::UnivariateDistribution) isleptokurtic(::UnivariateDistribution) ismesokurtic(::UnivariateDistribution) entropy(::UnivariateDistribution) entropy(::UnivariateDistribution, ::Real) mgf(::UnivariateDistribution, ::Any) cgf(::UnivariateDistribution, ::Any) cf(::UnivariateDistribution, ::Any) pdfsquaredL2norm ``` -------------------------------- ### Plot Density of TriangularDist Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of a TriangularDist with specified parameters and limits. Uses 6 equally spaced points for plotting. ```julia plotdensity((-0.5, 2), TriangularDist, (0, 1.5, 0.5); npoints=6) # hide ``` -------------------------------- ### Fit Distribution from Sufficient Statistics Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md Perform maximum likelihood estimation for a distribution `D` using pre-computed sufficient statistics `ss`. ```julia d = fit_mle(D, ss) ``` -------------------------------- ### Plot Density for Biweight Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Biweight distribution. Requires specifying the range and shape parameters. ```julia plotdensity((-1, 3), Biweight, (1, 2)) # hide ``` -------------------------------- ### Plot Density for Cauchy Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Cauchy distribution. Requires specifying the range and location-scale parameters. ```julia plotdensity((-12, 5), Cauchy, (-2, 1)) # hide ``` -------------------------------- ### Plot Density for Generalized Pareto Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Generalized Pareto distribution. Requires specifying the range and shape/scale/location parameters. ```julia plotdensity((0, 20), GeneralizedPareto, (0, 1, 1)) # hide ``` -------------------------------- ### Create Truncated Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Define a truncated version of an existing univariate distribution. This is useful when you need to constrain the range of a distribution. ```julia truncated(Normal(mu, sigma), l, u) ``` -------------------------------- ### Plot Density for Normal Inverse Gaussian Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Normal Inverse Gaussian distribution. Requires specifying the range and parameters. ```julia plotdensity((-2, 2), NormalInverseGaussian, (0, 0.5, 0.2, 0.1)) # hide ``` -------------------------------- ### Maximum Likelihood Estimation (MLE) Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md The `fit_mle` function is specifically for maximum likelihood estimation. It can be used with or without weights. ```APIDOC ## `fit_mle(D, x)` and `fit_mle(D, x, w)` ### Description Performs maximum likelihood estimation to fit a distribution of type `D` to a dataset `x`, optionally with weights `w`. ### Method `fit_mle` ### Parameters #### Path Parameters - **D** (Type) - Required - The type of the distribution to fit. - **x** (Array) - Required - The dataset (array of samples). - **w** (Array, Optional) - The weights for each sample in `x`. ### Request Example ```julia # Without weights d_unweighted = fit_mle(Normal, [1.0, 2.0, 3.0, 4.0, 5.0]) # With weights weights = [0.5, 1.0, 1.5, 2.0, 2.5] d_weighted = fit_mle(Normal, [1.0, 2.0, 3.0, 4.0, 5.0], weights) ``` ### Response #### Success Response (Distribution object) - Returns an instance of the fitted distribution `D`. ### Response Example ```julia Normal{Float64}(μ=3.0, σ=1.4142135623730951) ``` ``` -------------------------------- ### Computation of Statistics for Multivariate Distributions Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/multivariate.md These methods provide common statistical computations for multivariate distributions. ```APIDOC ## Computation of Statistics ### `length(::MultivariateDistribution)` Returns the number of dimensions of the distribution. ### `size(::MultivariateDistribution)` Returns the size of the distribution (number of dimensions). ### `eltype(::Type{MultivariateDistribution})` Returns the element type of the samples from the distribution. ### `mean(::MultivariateDistribution)` Computes the mean vector of the distribution. ### `var(::MultivariateDistribution)` Computes the variance vector of the distribution. ### `std(::MultivariateDistribution)` Computes the standard deviation vector of the distribution. ### `cov(::MultivariateDistribution)` Computes the covariance matrix of the distribution. ### `cor(::MultivariateDistribution)` Computes the correlation matrix of the distribution. ### `entropy(::MultivariateDistribution)` Computes the differential entropy of the distribution. ### `entropy(::MultivariateDistribution, ::Real)` Computes the conditional entropy of the distribution with respect to a given value. ``` -------------------------------- ### Maximum Likelihood Estimation Synopsis Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md These functions are used for maximum likelihood estimation of distribution parameters. ```julia fit(D, x) ``` ```julia fit(D, x, w) ``` ```julia fit_mle(D, x) ``` ```julia fit_mle(D, x, w) ``` -------------------------------- ### Plot Density for Cosine Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Cosine distribution. Requires specifying the range and parameters. ```julia plotdensity((-1, 1), Cosine, (0, 1)) # hide ``` -------------------------------- ### Plot Density for Pareto Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Pareto distribution. Requires specifying the range and shape/scale parameters. ```julia plotdensity((1, 8), Pareto, (1, 1)) # hide ``` -------------------------------- ### Plot Density for Logit Normal Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Logit Normal distribution. Requires specifying the range and location-scale parameters. ```julia plotdensity((0, 1), LogitNormal, (0, 1)) # hide ``` -------------------------------- ### Plot Density for Gamma Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Gamma distribution. Requires specifying the range and shape/scale parameters. ```julia plotdensity((0, 18), Gamma, (7.5, 1)) # hide ``` -------------------------------- ### Calculate Quantiles for Standard Normal Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Compute quantiles for a given distribution. This is useful for understanding percentiles and probability thresholds. ```julia quantile.(Normal(), [0.5, 0.95]) ``` -------------------------------- ### Plot Density for Inverse Gaussian Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Inverse Gaussian distribution. Requires specifying the range and mean/dispersion parameters. ```julia plotdensity((0, 5), InverseGaussian, (1, 1)) # hide ``` -------------------------------- ### Plot Density for PGeneralizedGaussian Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the P-Generalized Gaussian distribution. Requires specifying the range and parameter. ```julia plotdensity((0, 20), PGeneralizedGaussian, (0.2)) # hide ``` -------------------------------- ### Plot Density for Laplace Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Laplace distribution. Requires specifying the range and location-scale parameters. ```julia plotdensity((-20, 20), Laplace, (0, 4)) # hide ``` -------------------------------- ### Plot Density for Arcsine Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Arcsine distribution. Requires specifying the range and distribution parameters. ```julia plotdensity((0.001, 0.999), Arcsine, (0, 1)) # hide ``` -------------------------------- ### Plot Density of Uniform Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of a Uniform distribution with specified parameters and limits. Includes setting the y-axis limits. ```julia plotdensity((-0.5, 1.5), Uniform, (0, 1); ylim=(0, 1.5)) # hide ``` -------------------------------- ### Plot Density for Rayleigh Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Rayleigh distribution. Requires specifying the range and scale parameter. ```julia plotdensity((0, 2), Rayleigh, (0.5)) # hide ``` -------------------------------- ### Plot Density for Skew Normal Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Skew Normal distribution. Requires specifying the range and parameters. ```julia plotdensity((-4, 4), SkewNormal, (0, 1, -1)) # hide ``` -------------------------------- ### Plot Density for F Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the F distribution. Requires specifying the range and degrees of freedom. ```julia plotdensity((0, 10), FDist, (10, 1)) # hide ``` -------------------------------- ### Probability Evaluation Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Methods for evaluating probabilities, including PDF, CDF, and related logarithmic and inverse functions. ```APIDOC ## Probability Evaluation ```julia insupport(::UnivariateDistribution, x::Any) pdf(::UnivariateDistribution, ::Real) logpdf(::UnivariateDistribution, ::Real) gradlogpdf(::ContinuousUnivariateDistribution, ::Real) loglikelihood(::UnivariateDistribution, ::AbstractArray) cdf(::UnivariateDistribution, ::Real) logcdf(::UnivariateDistribution, ::Real) logdiffcdf(::UnivariateDistribution, ::Real, ::Real) ccdf(::UnivariateDistribution, ::Real) logccdf(::UnivariateDistribution, ::Real) quantile(::UnivariateDistribution, ::Real) cquantile(::UnivariateDistribution, ::Real) invlogcdf(::UnivariateDistribution, ::Real) invlogccdf(::UnivariateDistribution, ::Real) ``` ``` -------------------------------- ### Plot Density of VonMises Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of a VonMises distribution with specified parameters. Includes setting x-axis limits and custom tick labels for π. ```julia plotdensity((-π, π), VonMises, (0.5,); xlim=(-π, π), xticks=(π/5, 5), xticklabels=x -> x ≈ -π ? "-π" : (x ≈ π ? "π" : "0")) # hide ``` -------------------------------- ### Fit Distribution to Data Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md Fit a distribution of type `D` to a dataset `x`. This typically uses maximum likelihood estimation. ```julia d = fit(D, x) ``` -------------------------------- ### Plot Density for Inverse Gamma Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Inverse Gamma distribution. Requires specifying the range and shape/scale parameters. ```julia plotdensity((0.001, 1), InverseGamma, (3, 0.5)) # hide ``` -------------------------------- ### Plot Density for NormalCanon Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the NormalCanon distribution. Requires specifying the range and parameters. ```julia plotdensity((-4, 4), NormalCanon, (0, 1)) # hide ``` -------------------------------- ### Plot Density for Normal Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Normal distribution. Requires specifying the range and mean/standard deviation. ```julia plotdensity((-4, 4), Normal, (0, 1)) # hide ``` -------------------------------- ### Fit Normal Distribution to Data Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/starting.md Estimate the parameters (mean and standard deviation) of a normal distribution that best fits a given set of data. This is useful for empirical modeling. ```julia fit(Normal, x) ``` -------------------------------- ### Plot Density for Chi Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Chi distribution. Requires specifying the range and degrees of freedom. ```julia plotdensity((0.001, 3), Chi, (1,)) # hide ``` -------------------------------- ### Plot Density for Exponential Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Exponential distribution. Requires specifying the range and rate parameter. ```julia plotdensity((0, 3.5), Exponential, (0.5,)) # hide ``` -------------------------------- ### Compute Sufficient Statistics Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/fit.md Compute the sufficient statistics for a distribution `D` from data `x`. Supports weighted data. ```julia ss = suffstats(D, x) ``` ```julia ss = suffstats(D, x, w) ``` -------------------------------- ### Plot Density for Kumaraswamy Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Kumaraswamy distribution. Requires specifying the range and shape parameters. ```julia plotdensity((0, 1), Kumaraswamy, (2, 5)) # hide ``` -------------------------------- ### Plot Density for Rician Distribution Source: https://github.com/juliastats/distributions.jl/blob/master/docs/src/univariate.md Plots the density of the Rician distribution. Requires specifying the range and parameters. ```julia plotdensity((0, 5), Rician, (0.5, 1)) # hide ```