gammaEstimate

Estimates parameters of the gamma distribution.

  1. Tuple!(T, "shape", T, "scale") gammaEstimate(T[] sample)
  2. Tuple!(T, "shape", T, "scale") gammaEstimate(T[] sample, T[] weights)
    Tuple!(T, "shape", T, "scale")
    gammaEstimate
    (
    T
    )
    (
    in T[] sample
    ,
    in T[] weights
    )
    if (
    isFloatingPoint!T
    )
  3. Tuple!(T, "shape", T, "scale") gammaEstimate(GammaStatistic!T stat)

Examples

import atmosphere.estimate.generalized_gamma;
immutable sample = [1.0, 0.5, 0.75];
immutable weights = [1.0, 4, 3];
immutable p0 = gammaEstimate(sample, weights);
immutable p1 = generalizedGammaFixedPowerEstimate(1.0, sample, weights);
assert(p0.shape == p1.shape);
assert(p0.scale == p1.scale);
import atmosphere.estimate.generalized_gamma;
immutable sample = [1.0, 0.5, 0.75];
immutable p0 = gammaEstimate(sample);
immutable p1 = generalizedGammaFixedPowerEstimate(1.0, sample);
assert(p0.shape == p1.shape);
assert(p0.scale == p1.scale);
import std.range;
import std.random;
import atmosphere.random;
import atmosphere.likelihood.gamma;
auto length = 1000;
auto shape = 2.0, scale = 3.0;
auto rng = Random(1234);
auto sample = GammaSRNG!double(rng, shape, scale).take(length).array;
auto weights = iota(1.0, length + 1.0).array;
auto params = gammaEstimate!double(sample, weights);
auto lh0 = gammaLikelihood(shape, scale, sample, weights);
auto lh1 = gammaLikelihood(params.shape, params.scale, sample, weights);
assert(lh0 <= lh1);

Meta