properGeneralizedInverseGaussianEstimate

Estimates parameters of the proper generalized inverse Gaussian distribution.

  1. Tuple!(T, "lambda", T, "eta", T, "omega") properGeneralizedInverseGaussianEstimate(T[] sample, T relTolerance, T absTolerance)
  2. Tuple!(T, "lambda", T, "eta", T, "omega") properGeneralizedInverseGaussianEstimate(T[] sample, T[] weights, T relTolerance, T absTolerance)
  3. Tuple!(T, "lambda", T, "eta", T, "omega") properGeneralizedInverseGaussianEstimate(GeneralizedInverseGaussinStatistic!T stat, T relTolerance, T absTolerance)
    Tuple!(T, "lambda", T, "eta", T, "omega")
    properGeneralizedInverseGaussianEstimate
    (
    T
    )
    (,
    in T relTolerance = sqrt(T.epsilon)
    ,
    in T absTolerance = sqrt(T.epsilon)
    )
    if (
    isFloatingPoint!T
    )

Parameters

stat GeneralizedInverseGaussinStatistic!T

GIG statistica.

relTolerance T

Relative tolerance.

absTolerance T

Absolute tolerance.

Preconditions: ax and bx shall be finite reals.
relTolerance shall be normal positive real.
absTolerance shall be normal positive real no less then T.epsilon*2.

References: "Algorithms for Minimization without Derivatives", Richard Brent, Prentice-Hall, Inc. (1973)

Examples

import std.range;
import std.random;
import atmosphere.random;
import atmosphere.likelihood;
auto length = 1000;
auto lambda = -2.0, eta = 1.4, omega = 2.3;
auto rng = Random(1234);
auto sample = ProperGeneralizedInverseGaussianSRNG!double(rng, lambda, eta, omega).take(length).array;
auto params1 = properGeneralizedInverseGaussianEstimate(sample);
auto params2 = properGeneralizedInverseGaussianFixedLambdaEstimate!double(lambda, sample);
auto lh0 = properGeneralizedInverseGaussianLikelihood(lambda, eta, omega, sample);
auto lh1 = properGeneralizedInverseGaussianLikelihood(params1.lambda, params1.eta, params1.omega, sample);
auto lh2 = properGeneralizedInverseGaussianLikelihood(lambda, params2.eta, params2.omega, sample);
assert(lh0 <= lh1);
assert(lh0 <= lh2);
assert(lh2 <= lh1);
import std.range;
import std.random;
import atmosphere.random;
import atmosphere.likelihood;
auto length = 1000;
auto lambda = -2.0, eta = 1.4, omega = 2.3;
auto rng = Random(1234);
auto sample = ProperGeneralizedInverseGaussianSRNG!double(rng, lambda, eta, omega).take(length).array;
auto weights = iota(1.0, length + 1.0).array;
auto params1 = properGeneralizedInverseGaussianEstimate!double(sample, weights);
auto params2 = properGeneralizedInverseGaussianFixedLambdaEstimate!double(lambda, sample, weights);
auto lh0 = properGeneralizedInverseGaussianLikelihood(lambda, eta, omega, sample, weights);
auto lh1 = properGeneralizedInverseGaussianLikelihood(params1.lambda, params1.eta, params1.omega, sample, weights);
auto lh2 = properGeneralizedInverseGaussianLikelihood(lambda, params2.eta, params2.omega, sample, weights);
assert(lh0 <= lh1);
assert(lh0 <= lh2);
assert(lh2 <= lh1);

See Also

atmosphere.params

Meta