Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 780c9914 authored by Dahua Lin's avatar Dahua Lin

renamed "logNormal" --> "LogNorma" (type names should be consistently capitalized)

parent fa11fc35
......@@ -77,7 +77,7 @@ As of version 0.0.0, the package implements the following distributions:
* Laplace
* Levy
* Logistic
* logNormal
* LogNormal
* NoncentralBeta
* NoncentralChisq
* NoncentralF
......
......@@ -49,7 +49,7 @@ export # types
Logistic,
# LogitLink,
# LogLink,
logNormal,
LogNormal,
MixtureModel,
Multinomial,
MultivariateNormal,
......
immutable logNormal <: ContinuousUnivariateDistribution
immutable LogNormal <: ContinuousUnivariateDistribution
meanlog::Float64
sdlog::Float64
function logNormal(ml::Real, sdl::Real)
function LogNormal(ml::Real, sdl::Real)
if sdl > 0.0
new(float64(ml), float64(sdl))
else
......@@ -10,39 +10,39 @@ immutable logNormal <: ContinuousUnivariateDistribution
end
end
logNormal(ml::Real) = logNormal(ml, 1.0)
logNormal() = logNormal(0.0, 1.0)
LogNormal(ml::Real) = LogNormal(ml, 1.0)
LogNormal() = LogNormal(0.0, 1.0)
@_jl_dist_2p logNormal lnorm
@_jl_dist_2p LogNormal lnorm
entropy(d::logNormal) = 0.5 + 0.5 * log(2.0 * pi * d.sdlog^2) + d.meanlog
entropy(d::LogNormal) = 0.5 + 0.5 * log(2.0 * pi * d.sdlog^2) + d.meanlog
insupport(d::logNormal, x::Number) = isreal(x) && isfinite(x) && 0 < x
insupport(d::LogNormal, x::Number) = isreal(x) && isfinite(x) && 0 < x
function kurtosis(d::logNormal)
function kurtosis(d::LogNormal)
return exp(4.0 * d.sdlog^2) + 2.0 * exp(3.0 * d.sdlog^2) +
3.0 * exp(2.0 * d.sdlog^2) - 6.0
end
mean(d::logNormal) = exp(d.meanlog + d.sdlog^2 / 2)
mean(d::LogNormal) = exp(d.meanlog + d.sdlog^2 / 2)
median(d::logNormal) = exp(d.meanlog)
median(d::LogNormal) = exp(d.meanlog)
# mgf(d::logNormal)
# cf(d::logNormal)
# mgf(d::LogNormal)
# cf(d::LogNormal)
modes(d::logNormal) = [exp(d.meanlog - d.sdlog^2)]
modes(d::LogNormal) = [exp(d.meanlog - d.sdlog^2)]
function skewness(d::logNormal)
function skewness(d::LogNormal)
return (exp(d.sdlog^2) + 2.0) * sqrt(exp(d.sdlog^2) - 1.0)
end
function var(d::logNormal)
function var(d::LogNormal)
sigsq = d.sdlog^2
return (exp(sigsq) - 1) * exp(2d.meanlog + sigsq)
end
function fit_mle{T <: Real}(::Type{logNormal}, x::Array{T})
function fit_mle{T <: Real}(::Type{LogNormal}, x::Array{T})
lx = log(x)
return logNormal(mean(lx), std(lx))
return LogNormal(mean(lx), std(lx))
end
......@@ -13,4 +13,4 @@ end
@_jl_dist_3p NoncentralF nf
insupport(d::logNormal, x::Number) = isreal(x) && isfinite(x) && 0.0 <= x
insupport(d::NoncentralF, x::Number) = isreal(x) && isfinite(x) && 0.0 <= x
......@@ -31,7 +31,7 @@ for d in (Beta(),
Gumbel(),
Gumbel(5, 3),
Logistic(),
logNormal(),
LogNormal(),
Normal(),
TDist(1),
TDist(28),
......
......@@ -71,9 +71,9 @@ for d in [Arcsine(),
Logistic(0.0, 1.0),
Logistic(10.0, 1.0),
Logistic(0.0, 10.0),
logNormal(0.0, 1.0),
logNormal(10.0, 1.0),
logNormal(0.0, 10.0),
LogNormal(0.0, 1.0),
LogNormal(10.0, 1.0),
LogNormal(0.0, 10.0),
# NegativeBinomial(),
# NoncentralBeta(),
# NoncentralChisq(),
......@@ -205,7 +205,7 @@ for d in [Arcsine(),
# Bail on higher moments for LogNormal distribution or
# truncated distributions
if isa(d, logNormal) || isa(d, TruncatedUnivariateDistribution)
if isa(d, LogNormal) || isa(d, TruncatedUnivariateDistribution)
continue
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment