From 5ed3a2c92da05afee6f697a75b72427e36be7584 Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Wed, 25 Mar 2026 11:52:08 -0400 Subject: [PATCH 1/6] Fix docstring reference for `fit()` in fit.md --- docs/src/fit.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/src/fit.md b/docs/src/fit.md index 68bdfb4bb8..2edbefd406 100644 --- a/docs/src/fit.md +++ b/docs/src/fit.md @@ -27,8 +27,7 @@ The function `fit_mle` is for maximum likelihood estimation. ### Synopsis ```@docs -fit(D, x) -fit(D, x, w) +fit(::Type{<:Distribution}, x) fit_mle(D, x) fit_mle(D, x, w) ``` From c8f797909d18c5aa52609432d14fd06a53805fda Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:19:21 -0400 Subject: [PATCH 2/6] Create `loglikelihood` docstring for univariate distributions --- src/univariates.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/univariates.jl b/src/univariates.jl index 36fc5a214d..ca2f024b69 100644 --- a/src/univariates.jl +++ b/src/univariates.jl @@ -326,6 +326,16 @@ logpdf(d::UnivariateDistribution, x::Real) # extract value from array of zero dimension logpdf(d::UnivariateDistribution, x::AbstractArray{<:Real,0}) = logpdf(d, first(x)) +""" + loglikelihood(d::UnivariateDistribution, x) + +The log-likelihood of distribution `d` with respect to `x`. + +Here, `x` can be any output of `rand(d, dims...)` and `rand!(d, x)`. +For univariate distributions, `x` therfore must be a scalar or +an array with an arbitrary number of dimensions. +""" +loglikelihood(d::UnivariateDistribution, x::AbstractArray) # loglikelihood for `Real` Base.@propagate_inbounds loglikelihood(d::UnivariateDistribution, x::Real) = logpdf(d, x) From 4a9f91b0f8fbac42843460f1b647a4a58ef839e0 Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:21:00 -0400 Subject: [PATCH 3/6] Fix syntax for `@docs` block --- docs/src/types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/types.md b/docs/src/types.md index 8a738731ac..f66dd52ac7 100644 --- a/docs/src/types.md +++ b/docs/src/types.md @@ -70,7 +70,7 @@ We use `Distribution`, a subtype of `Sampleable` as defined below, to capture pr abstract type Distribution{F<:VariateForm,S<:ValueSupport} <: Sampleable{F,S} end ``` -```@doc +```@docs Distributions.Distribution ``` From 927162df862122f2ae5b37b2e7f88af0c51ae024 Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:28:11 -0400 Subject: [PATCH 4/6] Add docstring for `ReshapedDistribution` to docs site --- docs/src/reshape.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/reshape.md b/docs/src/reshape.md index d381d74fca..b4947d4c8e 100644 --- a/docs/src/reshape.md +++ b/docs/src/reshape.md @@ -4,6 +4,7 @@ Distributions of array variates such as `MultivariateDistribution`s and `MatrixDistribution`s can be reshaped. ```@docs +Distributions.ReshapedDistribution reshape vec ``` From 5a0deb9a1e99873d4563ba735a22108a377cd6d6 Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:35:14 -0400 Subject: [PATCH 5/6] Add docstrings of `VariateForm` subtypes to docs site --- docs/src/types.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/src/types.md b/docs/src/types.md index f66dd52ac7..13fa83548f 100644 --- a/docs/src/types.md +++ b/docs/src/types.md @@ -23,7 +23,12 @@ Base.rand(::Distributions.Sampleable) Distributions.VariateForm ``` -The `VariateForm` subtypes defined in `Distributions.jl` are: +The most commonly used `VariateForm` is the `ArrayLikeVariate`: +```@docs +Distributions.ArrayLikeVariate +``` + +The `ArrayLikeVariate` types defined in `Distributions.jl` are: **Type** | **A single sample** | **Multiple samples** --- | --- |--- @@ -31,6 +36,13 @@ The `VariateForm` subtypes defined in `Distributions.jl` are: `Multivariate == ArrayLikeVariate{1}` | a numeric vector | A matrix, each column being a sample `Matrixvariate == ArrayLikeVariate{2}` | a numeric matrix | An array of matrices, each element being a sample matrix +`Distributions.jl` also defines some other `VariateForm` subtypes + +```@docs +Distributions.NamedTupleVariate +Distributions.CholeskyVariate +``` + ### ValueSupport ```@docs From 7a192cadc5d3cd753de4ebba4e1f7dde4c7d8a03 Mon Sep 17 00:00:00 2001 From: abhro <5664668+abhro@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:49:31 -0400 Subject: [PATCH 6/6] Remove `ReshapedDistribution` docstring from docs site --- docs/src/reshape.md | 1 - src/reshaped.jl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/src/reshape.md b/docs/src/reshape.md index b4947d4c8e..d381d74fca 100644 --- a/docs/src/reshape.md +++ b/docs/src/reshape.md @@ -4,7 +4,6 @@ Distributions of array variates such as `MultivariateDistribution`s and `MatrixDistribution`s can be reshaped. ```@docs -Distributions.ReshapedDistribution reshape vec ``` diff --git a/src/reshaped.jl b/src/reshaped.jl index 1fdfde033d..f557d40f69 100644 --- a/src/reshaped.jl +++ b/src/reshaped.jl @@ -103,7 +103,7 @@ end Return a [`Distribution`](@ref) of `reshape(X, dims)` where `X` is a random variable with distribution `d`. -The default implementation returns a [`ReshapedDistribution`](@ref). However, it can return +The default implementation returns a `ReshapedDistribution`. However, it can return more optimized distributions for specific types of distributions and numbers of dimensions. Therefore it is recommended to use `reshape` instead of the constructor of `ReshapedDistribution`.