From a1132e736f638d6928493bc7c3e3ecf784b8ae9d Mon Sep 17 00:00:00 2001 From: azev77 Date: Thu, 23 Apr 2020 12:02:33 -0400 Subject: [PATCH 01/13] Add files via upload Add Skewnormal distribution based on: * [Skew normal distribution on Wikipedia](https://en.wikipedia.org/wiki/Skew_normal_distribution) * [Discourse](https://discourse.julialang.org/t/skew-normal-distribution/21549/7) * [SkewDist.jl](https://github.com/STOR-i/SkewDist.jl) --- src/univariate/continuous/skewnormal.jl | 81 +++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/univariate/continuous/skewnormal.jl diff --git a/src/univariate/continuous/skewnormal.jl b/src/univariate/continuous/skewnormal.jl new file mode 100644 index 000000000..fae82b1d6 --- /dev/null +++ b/src/univariate/continuous/skewnormal.jl @@ -0,0 +1,81 @@ +""" +SkewNormal(ξ, ω, α) + The *skew normal distribution* is a continuous probability distribution + that generalises the normal distribution to allow for non-zero skewness. +# +External links +* [Skew normal distribution on Wikipedia](https://en.wikipedia.org/wiki/Skew_normal_distribution) +* [Discourse](https://discourse.julialang.org/t/skew-normal-distribution/21549/7) +* [SkewDist.jl](https://github.com/STOR-i/SkewDist.jl) +""" + +struct SkewNormal{T<:Real} <: ContinuousUnivariateDistribution + ξ::T + ω::T + α::T + SkewNormal{T}(ξ::T, ω::T, α::T) where {T} = new{T}(ξ, ω, α) +end + +function SkewNormal(ξ::T, ω::T, α::T; check_args=true) where {T <: Real} + check_args && @check_args(SkewNormal, ω > zero(ω)) + return SkewNormal{T}(ξ, ω, α) +end + +SkewNormal(ξ::Real, ω::Real, α::Real) = SkewNormal(promote(ξ, ω, α)...) +SkewNormal(ξ::Integer, ω::Integer, α::Integer) = SkewNormal(float(ξ), float(ω), float(α)) +SkewNormal(α::T) where {T <: Real} = SkewNormal(zero(α), one(α), α) +SkewNormal() = SkewNormal(0.0, 1.0, 0.0) + +@distr_support SkewNormal -Inf Inf + +#### Conversions +#convert(::Type{SkewNormal{T}}, ξ::S, ω::S, α::S) where {T <: Real, S <: Real} = SkewNormal(T(μ), T(σ)) +#convert(::Type{SkewNormal{T}}, d::SkewNormal{S}) where {T <: Real, S <: Real} = SkewNormal(T(d.μ), T(d.σ), check_args=false) + +#### Parameters +params(d::SkewNormal) = (d.ξ, d.ω, d.α) +#partype(::SkewNormal{T}) where {T} = T + +#### Statistics +delta(d::SkewNormal) = d.α/√(1+d.α^2) +mean_z(d::SkewNormal) = √(2/π) * delta(d) +std_z(d::SkewNormal) = 1 - 2/π * delta(d)^2 + +mean(d::SkewNormal) = d.ξ + d.ω * mean_z(d) +var(d::SkewNormal) = abs2(d.ω)*(1-mean_z(d)^2) +std(d::SkewNormal) = √var(d) +skewness(d::SkewNormal) = (4-π)/2 * mean_z(d)^3 / (1-mean_z(d)^2)^(3/2) + +#### Evalution +pdf(d::SkewNormal, x::Real) = 2/d.ω*normpdf((x-d.ξ)/d.ω)*normcdf(d.α*(x-d.ξ)/d.ω) +logpdf(d::SkewNormal, x::Real) = log(2)-log(d.ω)+normlogpdf((x-d.ξ)/d.ω)+normlogcdf(d.α*(x-d.ξ)/d.ω) +#cdf/quantile etc mgf/cf + +#### Sampling +function rand(rng::AbstractRNG, d::SkewNormal) + u0 = randn(rng) + v = randn(rng) + δ = delta(d) + u1 = δ * u0 + √(1-δ^2) * v + return d.ξ + d.ω * sign(u0) * u1 +end + +## Fitting +# function fit_mle(::Type{<:LogNormal}, x::AbstractArray{T}) where T<:Real +# lx = log.(x) +# μ, σ = mean_and_std(lx) +# LogNormal(μ, σ) +# end + + +### AZ test +# d= SkewNormal() +# mean(d) +# var(d) +# +# using Random +# rng = MersenneTwister(123) +# rand(rng, d) +# +# import Distributions: normpdf, normcdf +# pdf.(d, -10:10 ) From 3f40d9c7763cd6875fa0d8b2b1d44453123b3a16 Mon Sep 17 00:00:00 2001 From: azev77 Date: Sat, 9 May 2020 18:50:52 -0400 Subject: [PATCH 02/13] Update skewnormal.jl --- src/univariate/continuous/skewnormal.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/univariate/continuous/skewnormal.jl b/src/univariate/continuous/skewnormal.jl index fae82b1d6..f34144af9 100644 --- a/src/univariate/continuous/skewnormal.jl +++ b/src/univariate/continuous/skewnormal.jl @@ -8,7 +8,6 @@ External links * [Discourse](https://discourse.julialang.org/t/skew-normal-distribution/21549/7) * [SkewDist.jl](https://github.com/STOR-i/SkewDist.jl) """ - struct SkewNormal{T<:Real} <: ContinuousUnivariateDistribution ξ::T ω::T From 3678a8371e2ad26dd4c9d048018dce997dc8bd37 Mon Sep 17 00:00:00 2001 From: azev77 Date: Sun, 28 Jun 2020 23:36:36 -0400 Subject: [PATCH 03/13] Update skewnormal.jl --- src/univariate/continuous/skewnormal.jl | 32 ++++++++++--------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/univariate/continuous/skewnormal.jl b/src/univariate/continuous/skewnormal.jl index f34144af9..ef21ca3c5 100644 --- a/src/univariate/continuous/skewnormal.jl +++ b/src/univariate/continuous/skewnormal.jl @@ -3,6 +3,8 @@ SkewNormal(ξ, ω, α) The *skew normal distribution* is a continuous probability distribution that generalises the normal distribution to allow for non-zero skewness. # +This code is based on the three external links below. +# External links * [Skew normal distribution on Wikipedia](https://en.wikipedia.org/wiki/Skew_normal_distribution) * [Discourse](https://discourse.julialang.org/t/skew-normal-distribution/21549/7) @@ -28,12 +30,12 @@ SkewNormal() = SkewNormal(0.0, 1.0, 0.0) @distr_support SkewNormal -Inf Inf #### Conversions -#convert(::Type{SkewNormal{T}}, ξ::S, ω::S, α::S) where {T <: Real, S <: Real} = SkewNormal(T(μ), T(σ)) -#convert(::Type{SkewNormal{T}}, d::SkewNormal{S}) where {T <: Real, S <: Real} = SkewNormal(T(d.μ), T(d.σ), check_args=false) +convert(::Type{SkewNormal{T}}, ξ::S, ω::S, α::S) where {T <: Real, S <: Real} = SkewNormal(T(ξ), T(ω), T(α)) +convert(::Type{SkewNormal{T}}, d::SkewNormal{S}) where {T <: Real, S <: Real} = SkewNormal(T(d.ξ), T(d.ω), T(d.α), check_args=false) #### Parameters params(d::SkewNormal) = (d.ξ, d.ω, d.α) -#partype(::SkewNormal{T}) where {T} = T +@inline partype(d::SkewNormal{T}) where {T<:Real} = T #### Statistics delta(d::SkewNormal) = d.α/√(1+d.α^2) @@ -45,9 +47,15 @@ var(d::SkewNormal) = abs2(d.ω)*(1-mean_z(d)^2) std(d::SkewNormal) = √var(d) skewness(d::SkewNormal) = (4-π)/2 * mean_z(d)^3 / (1-mean_z(d)^2)^(3/2) +# no analytic expression for max m_0(d) but accurate numerical approximation +m_0(d::SkewNormal) = mean_z(d) - (skewness(d)*std_z(d))/2 - (sign(d.α)/2)*exp(-2π/abs(d.α)) +mode(d::SkewNormal) = d.ξ + d.ω * m_0(d) + + #### Evalution pdf(d::SkewNormal, x::Real) = 2/d.ω*normpdf((x-d.ξ)/d.ω)*normcdf(d.α*(x-d.ξ)/d.ω) logpdf(d::SkewNormal, x::Real) = log(2)-log(d.ω)+normlogpdf((x-d.ξ)/d.ω)+normlogcdf(d.α*(x-d.ξ)/d.ω) +#cdf requires Owen's T function. #cdf/quantile etc mgf/cf #### Sampling @@ -59,22 +67,6 @@ function rand(rng::AbstractRNG, d::SkewNormal) return d.ξ + d.ω * sign(u0) * u1 end -## Fitting -# function fit_mle(::Type{<:LogNormal}, x::AbstractArray{T}) where T<:Real -# lx = log.(x) -# μ, σ = mean_and_std(lx) -# LogNormal(μ, σ) -# end +## Fitting # to be added see: https://github.com/STOR-i/SkewDist.jl/issues/3 -### AZ test -# d= SkewNormal() -# mean(d) -# var(d) -# -# using Random -# rng = MersenneTwister(123) -# rand(rng, d) -# -# import Distributions: normpdf, normcdf -# pdf.(d, -10:10 ) From d0022ba5971c2cb101465f40f3935a479ecd856b Mon Sep 17 00:00:00 2001 From: azev77 Date: Sun, 28 Jun 2020 23:46:28 -0400 Subject: [PATCH 04/13] Update Distributions.jl --- src/Distributions.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Distributions.jl b/src/Distributions.jl index 6c1b0e6f1..7a2cc8e9c 100644 --- a/src/Distributions.jl +++ b/src/Distributions.jl @@ -141,6 +141,7 @@ export Rayleigh, Semicircle, Skellam, + SkewNormal, StudentizedRange, SymTriangularDist, TDist, From 0145677be5beeebbcdad6e6586a81c205865e74b Mon Sep 17 00:00:00 2001 From: azev77 Date: Sun, 28 Jun 2020 23:47:59 -0400 Subject: [PATCH 05/13] Update univariates.jl --- src/univariates.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/univariates.jl b/src/univariates.jl index 6c8827420..2a02cb875 100644 --- a/src/univariates.jl +++ b/src/univariates.jl @@ -624,6 +624,7 @@ const continuous_distributions = [ "pareto", "rayleigh", "semicircle", + "skewnormal", "studentizedrange", "symtriangular", "tdist", From dfcaf7b2a4fe578846648e76f91068c0596b58b2 Mon Sep 17 00:00:00 2001 From: azev77 Date: Sun, 28 Jun 2020 23:49:40 -0400 Subject: [PATCH 06/13] Update runtests.jl --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index 7814090ad..6f78298ab 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -55,6 +55,7 @@ const tests = [ "univariate_bounds", "negativebinomial", "bernoulli", + "skewnormal", ] printstyled("Running tests:\n", color=:blue) From 333459fd38a0b3237dca8d89b1aafe233bbb7dbc Mon Sep 17 00:00:00 2001 From: azev77 Date: Mon, 29 Jun 2020 00:29:06 -0400 Subject: [PATCH 07/13] Create skewnormal.jl --- test/skewnormal.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/skewnormal.jl diff --git a/test/skewnormal.jl b/test/skewnormal.jl new file mode 100644 index 000000000..8ba13c652 --- /dev/null +++ b/test/skewnormal.jl @@ -0,0 +1,28 @@ +using Test +using Distributions +import Distributions: normpdf, normcdf, normlogpdf, normlogcdf + +@testset "SkewNormal" begin + @test_throws ArgumentError SkewNormal(0.0, 0.0, 0.0) + d1 = SkewNormal(1, 2, 3) + d2 = SkewNormal(1.0f0, 2, 3) + @test partype(d1) == Float64 + @test partype(d2) == Float32 + @test params(d1) == (1.0, 2.0, 3.0) + # Azzalini sn: sprintf("%.17f",dsn(3.3, xi=1, omega=2, alpha=3)) + @test pdf(d1, 3.3) ≈ 0.20587854616839998 + @test minimum(d1) ≈ -Inf + @test maximum(d1) ≈ Inf + @test logpdf(d1, 3.3) ≈ log(pdf(d1, 3.3)) + ## cdf and quantile: when we get Owen's T + #@test cdf(d, 4.5) ≈ 1.0 #when we get Owen's T + @test mean(d1) ≈ 2.513879513212096 + @test std(d1) ≈ 1.306969326142243 +end + +# R code using Azzalini's package sn +#library("sn") +#sprintf("%.17f", dsn(3.3, xi=1, omega=2, alpha=3)) +#f1 <- makeSECdistr(dp=c(1,2,3), family="SN", name="First-SN") +#sprintf("%.15f", mean(f1)) +#sprintf("%.15f", sd(f1)) From 56e4d4cd4a85401c542531618b678ed3fb1cf29d Mon Sep 17 00:00:00 2001 From: azev77 Date: Mon, 29 Jun 2020 01:48:05 -0400 Subject: [PATCH 08/13] Update skewnormal.jl --- src/univariate/continuous/skewnormal.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/univariate/continuous/skewnormal.jl b/src/univariate/continuous/skewnormal.jl index ef21ca3c5..a1eceaf47 100644 --- a/src/univariate/continuous/skewnormal.jl +++ b/src/univariate/continuous/skewnormal.jl @@ -46,17 +46,21 @@ mean(d::SkewNormal) = d.ξ + d.ω * mean_z(d) var(d::SkewNormal) = abs2(d.ω)*(1-mean_z(d)^2) std(d::SkewNormal) = √var(d) skewness(d::SkewNormal) = (4-π)/2 * mean_z(d)^3 / (1-mean_z(d)^2)^(3/2) +kurtosis(d::SkewNormal) = 2*(π-3)*( (delta(d)* sqrt(2/π) )^4 / (1-2*(delta(d)^2)/π)^2) # no analytic expression for max m_0(d) but accurate numerical approximation m_0(d::SkewNormal) = mean_z(d) - (skewness(d)*std_z(d))/2 - (sign(d.α)/2)*exp(-2π/abs(d.α)) mode(d::SkewNormal) = d.ξ + d.ω * m_0(d) - #### Evalution pdf(d::SkewNormal, x::Real) = 2/d.ω*normpdf((x-d.ξ)/d.ω)*normcdf(d.α*(x-d.ξ)/d.ω) logpdf(d::SkewNormal, x::Real) = log(2)-log(d.ω)+normlogpdf((x-d.ξ)/d.ω)+normlogcdf(d.α*(x-d.ξ)/d.ω) #cdf requires Owen's T function. -#cdf/quantile etc mgf/cf +#cdf/quantile etc + +mgf(d::SkewNormal, t::Real) = 2*exp(d.ξ*t + (d.ω^2 * t^2)/2 ) * normcdf(d.ω * delta(d) * t) + +cf(d::SkewNormal, t::Real) = exp(im*t*d.ξ - (d.ω^2 * t^2)/2) * (1 + im *erfi((d.ω * delta(d) * t)/(sqrt(2))) ) #### Sampling function rand(rng::AbstractRNG, d::SkewNormal) From 40a4d672f4aca4d35c15018eeb607d5142dfc537 Mon Sep 17 00:00:00 2001 From: azev77 Date: Fri, 3 Jul 2020 01:49:52 -0400 Subject: [PATCH 09/13] Update skewnormal.jl --- test/skewnormal.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/skewnormal.jl b/test/skewnormal.jl index 8ba13c652..eee6dd9be 100644 --- a/test/skewnormal.jl +++ b/test/skewnormal.jl @@ -18,6 +18,17 @@ import Distributions: normpdf, normcdf, normlogpdf, normlogcdf #@test cdf(d, 4.5) ≈ 1.0 #when we get Owen's T @test mean(d1) ≈ 2.513879513212096 @test std(d1) ≈ 1.306969326142243 + # + d0 = SkewNormal(0.0, 1.0, 0.0) + @test SkewNormal() == d0 + d3 = SkewNormal(0.5, 2.2, 0.0) + d4 = Normal(0.5, 2.2) + # + @test pdf(d3, 3.3) == Distributions.pdf(d4, 3.3) + @test pdf.(d3, 1:3) == Distributions.pdf.(d4, 1:3) + a = mean(d3), var(d3), std(d3) + b = Distributions.mean(d4), Distributions.var(d4), Distributions.std(d4) + @test a == b end # R code using Azzalini's package sn From e6c0c941b855177d5e8809004417be51c65c11b8 Mon Sep 17 00:00:00 2001 From: azev77 Date: Fri, 3 Jul 2020 14:22:45 -0400 Subject: [PATCH 10/13] Update skewnormal.jl --- test/skewnormal.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/skewnormal.jl b/test/skewnormal.jl index eee6dd9be..906c4d039 100644 --- a/test/skewnormal.jl +++ b/test/skewnormal.jl @@ -27,10 +27,16 @@ import Distributions: normpdf, normcdf, normlogpdf, normlogcdf @test pdf(d3, 3.3) == Distributions.pdf(d4, 3.3) @test pdf.(d3, 1:3) == Distributions.pdf.(d4, 1:3) a = mean(d3), var(d3), std(d3) + #b = mean(d4), var(d4), std(d4) b = Distributions.mean(d4), Distributions.var(d4), Distributions.std(d4) @test a == b + @test skewness(d3) == Distributions.skewness(d4) + @test kurtosis(d3) == Distributions.kurtosis(d4) + @test mgf(d3, 2.25) == Distributions.mgf(d4, 2.25) + @test cf(d3, 2.25) == Distributions.cf(d4, 2.25) end + # R code using Azzalini's package sn #library("sn") #sprintf("%.17f", dsn(3.3, xi=1, omega=2, alpha=3)) From e08e7f640b8bfae0d47f9fa3bdf22ab3f2903a52 Mon Sep 17 00:00:00 2001 From: azev77 Date: Fri, 17 Jul 2020 16:59:31 -0400 Subject: [PATCH 11/13] Update skewnormal.jl --- src/univariate/continuous/skewnormal.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/univariate/continuous/skewnormal.jl b/src/univariate/continuous/skewnormal.jl index a1eceaf47..fd3cac1c2 100644 --- a/src/univariate/continuous/skewnormal.jl +++ b/src/univariate/continuous/skewnormal.jl @@ -2,9 +2,6 @@ SkewNormal(ξ, ω, α) The *skew normal distribution* is a continuous probability distribution that generalises the normal distribution to allow for non-zero skewness. -# -This code is based on the three external links below. -# External links * [Skew normal distribution on Wikipedia](https://en.wikipedia.org/wiki/Skew_normal_distribution) * [Discourse](https://discourse.julialang.org/t/skew-normal-distribution/21549/7) From 81cad7cbfdceecc99e9c50f1ef517b140c55ab46 Mon Sep 17 00:00:00 2001 From: azev77 Date: Fri, 17 Jul 2020 17:11:38 -0400 Subject: [PATCH 12/13] Update skewnormal.jl --- src/univariate/continuous/skewnormal.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/univariate/continuous/skewnormal.jl b/src/univariate/continuous/skewnormal.jl index fd3cac1c2..3fe437563 100644 --- a/src/univariate/continuous/skewnormal.jl +++ b/src/univariate/continuous/skewnormal.jl @@ -35,29 +35,29 @@ params(d::SkewNormal) = (d.ξ, d.ω, d.α) @inline partype(d::SkewNormal{T}) where {T<:Real} = T #### Statistics -delta(d::SkewNormal) = d.α/√(1+d.α^2) +delta(d::SkewNormal) = d.α / √(1 + d.α^2) mean_z(d::SkewNormal) = √(2/π) * delta(d) -std_z(d::SkewNormal) = 1 - 2/π * delta(d)^2 +std_z(d::SkewNormal) = 1 - (2/π) * delta(d)^2 mean(d::SkewNormal) = d.ξ + d.ω * mean_z(d) -var(d::SkewNormal) = abs2(d.ω)*(1-mean_z(d)^2) +var(d::SkewNormal) = abs2(d.ω) * (1 - mean_z(d)^2) std(d::SkewNormal) = √var(d) -skewness(d::SkewNormal) = (4-π)/2 * mean_z(d)^3 / (1-mean_z(d)^2)^(3/2) -kurtosis(d::SkewNormal) = 2*(π-3)*( (delta(d)* sqrt(2/π) )^4 / (1-2*(delta(d)^2)/π)^2) +skewness(d::SkewNormal) = ((4 - π)/2) * (mean_z(d)^3/(1 - mean_z(d)^2)^(3/2)) +kurtosis(d::SkewNormal) = 2 * (π-3) * ((delta(d) * sqrt(2/π))^4/(1-2 * (delta(d)^2)/π)^2) # no analytic expression for max m_0(d) but accurate numerical approximation -m_0(d::SkewNormal) = mean_z(d) - (skewness(d)*std_z(d))/2 - (sign(d.α)/2)*exp(-2π/abs(d.α)) +m_0(d::SkewNormal) = mean_z(d) - (skewness(d) * std_z(d))/2 - (sign(d.α)/2) * exp(-2π/abs(d.α)) mode(d::SkewNormal) = d.ξ + d.ω * m_0(d) #### Evalution -pdf(d::SkewNormal, x::Real) = 2/d.ω*normpdf((x-d.ξ)/d.ω)*normcdf(d.α*(x-d.ξ)/d.ω) -logpdf(d::SkewNormal, x::Real) = log(2)-log(d.ω)+normlogpdf((x-d.ξ)/d.ω)+normlogcdf(d.α*(x-d.ξ)/d.ω) +pdf(d::SkewNormal, x::Real) = (2/d.ω) * normpdf((x-d.ξ)/d.ω) * normcdf(d.α * (x-d.ξ)/d.ω) +logpdf(d::SkewNormal, x::Real) = log(2) - log(d.ω) + normlogpdf((x-d.ξ) / d.ω) + normlogcdf(d.α * (x-d.ξ) / d.ω) #cdf requires Owen's T function. #cdf/quantile etc -mgf(d::SkewNormal, t::Real) = 2*exp(d.ξ*t + (d.ω^2 * t^2)/2 ) * normcdf(d.ω * delta(d) * t) +mgf(d::SkewNormal, t::Real) = 2 * exp(d.ξ * t + (d.ω^2 * t^2)/2 ) * normcdf(d.ω * delta(d) * t) -cf(d::SkewNormal, t::Real) = exp(im*t*d.ξ - (d.ω^2 * t^2)/2) * (1 + im *erfi((d.ω * delta(d) * t)/(sqrt(2))) ) +cf(d::SkewNormal, t::Real) = exp(im * t * d.ξ - (d.ω^2 * t^2)/2) * (1 + im * erfi((d.ω * delta(d) * t)/(sqrt(2))) ) #### Sampling function rand(rng::AbstractRNG, d::SkewNormal) From 8b9a2545873cb544d4371a8b621b1cad72a71efa Mon Sep 17 00:00:00 2001 From: azev77 Date: Fri, 17 Jul 2020 17:13:50 -0400 Subject: [PATCH 13/13] Update skewnormal.jl --- test/skewnormal.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/skewnormal.jl b/test/skewnormal.jl index 906c4d039..2e7497c08 100644 --- a/test/skewnormal.jl +++ b/test/skewnormal.jl @@ -27,9 +27,8 @@ import Distributions: normpdf, normcdf, normlogpdf, normlogcdf @test pdf(d3, 3.3) == Distributions.pdf(d4, 3.3) @test pdf.(d3, 1:3) == Distributions.pdf.(d4, 1:3) a = mean(d3), var(d3), std(d3) - #b = mean(d4), var(d4), std(d4) b = Distributions.mean(d4), Distributions.var(d4), Distributions.std(d4) - @test a == b + @test a == b @test skewness(d3) == Distributions.skewness(d4) @test kurtosis(d3) == Distributions.kurtosis(d4) @test mgf(d3, 2.25) == Distributions.mgf(d4, 2.25)