Skip to content

tk-yoshimura/DoubleDoubleStatistic

Repository files navigation

DoubleDoubleStatistic

Double-Double Statistic Implements

Requirement

.NET 8.0
DoubleDouble
DoubleDoubleComplex
Algebra

Install

Download DLL
Download Nuget

Implemented Distributions

Continuous

category distribution PDF CDF quantile statistic fitting random generation note
stable cauchy
delta
holtsmark
landau
levy
map-airy
normal
sas point5
linearity cosine
davis CDF and Quantile take longer to calculate.
frechet
gumbel
johnson sb
johnson su
laplace
logistic
skew cauchy
skew normal Quantile take longer to calculate.
uniform
u quadratic
weibull
scalable benini
birnbaum saunders
exponential
folded normal
gamma
gompertz
half cauchy
half logistic
half normal
hyperbolic secant
inverse gauss Quantile take longer to calculate.
log logistic
lomax
maxwell
q-exponential Accuracy decreases when q is nearly 2.
q-gaussian Accuracy decreases when q is nearly 3.
pareto
rayleigh
voigt CDF and Quantile take longer to calculate.
wigner semicircle
continuous alpha
arcsine -
argus
benktander Quantile take longer to calculate.
bates - n ≤ 128
beta
beta prime
bradford
burr
chi
chi square
dagum
fisher z
fisk
hotelling t sq
inverse gamma
inverse chi
inverse chi sq
irwin hall - n ≤ 128
kumaraswamy
log normal
nakagami
noncentral beta Accuracy decreases when non-centricity is large.
noncentral chi sq Accuracy decreases when non-centricity is large.
noncentral f Accuracy decreases when non-centricity is large.
noncentral t Accuracy decreases when non-centricity is large.
power
reciprocal
rice CDF and Quantile take longer to calculate.
snedecor f
student t
trapezoid
triangular
tukey lambda

Discrete

category distribution PMF statistic fitting random generation note
discrete bernoulli
benford -
binary -
binomial
categorical -
discrete uniform
gausskuzmin -
geometric
hyper geometric -
logarithmic
negative binomial
pascal
poisson
skellam
yule simon
zipf

Directional

category distribution PDF statistic fitting random generation note
directional circular cauchy Not implemented: kurtosis
von mises Not implemented: kurtosis
sphere uniform - Not implemented: kurtosis
von mises fisher Dim=3, Not implemented: kurtosis

MultiVariate

category distribution PDF statistic fitting random generation note
multivariate ball uniform -
dirichlet
disk uniform -
multi normal

Usage

NormalDistribution dist = new(mu: 1, sigma: 3);

// PDF
for (ddouble x = -4; x <= 4; x += 0.125) {
    ddouble pdf = dist.PDF(x);

    Console.WriteLine($"pdf({x})={pdf}");
}

// CDF
for (ddouble x = -4; x <= 4; x += 0.125) {
    ddouble ccdf = dist.CDF(x, Interval.Upper);

    Console.WriteLine($"ccdf({x})={ccdf}");
}

// Quantile
for (int i = 0; i <= 10; i++) {
    ddouble p = (ddouble)i / 10;
    ddouble x = dist.Quantile(p, Interval.Upper);

    Console.WriteLine($"cquantile({p})={x}");
}

// Statistic
Console.WriteLine($"Support={dist.Support}");
Console.WriteLine($"Mu={dist.Mu}");
Console.WriteLine($"Sigma={dist.Sigma}");
Console.WriteLine($"Mean={dist.Mean}");
Console.WriteLine($"Median={dist.Median}");
Console.WriteLine($"Mode={dist.Mode}");
Console.WriteLine($"Variance={dist.Variance}");
Console.WriteLine($"Skewness={dist.Skewness}");
Console.WriteLine($"Kurtosis={dist.Kurtosis}");
Console.WriteLine($"Entropy={dist.Entropy}");

// Random Sampling
Random random = new(1234);
double[] xs = dist.Sample(random, 100000).ToArray();

// Fitting
// note: The distribution that minimizes the squared error 
//       of the quantile function over the specified interval is return.
(NormalDistribution? dist_fit, ddouble error) = 
    NormalDistribution.Fit(xs, fitting_quantile_range: (0.1, 0.9));

Typical parameter symbols

category symbol note
support parameter k
a, b uniform
a, b, c triangular
shape parameter alpha
alpha, beta beta, beta prime
gamma, delta johnson sb, su
eta gompertz
nu chi, chisq, student t
n irwin hall
n, m fisher z, snedecor f
c stable distributions
location parameter mu
scale parameter sigma error-related distributions
theta time-related distributions
s, r otherwise
non-centricity parameter lambda
mu non-central student t

Licence

MIT

Author

T.Yoshimura