public Tuple!(T, "shape", T, "scale") gammaEstimate(T)(in T[] sample) 
if(isFloatingPoint!T)

Estimates parameters of the gamma distribution.

Example

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);

Example

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);

public Tuple!(T, "shape", T, "scale") gammaEstimate(T)(
    in T[] sample, 
    in T[] weights) 
if(isFloatingPoint!T)

Estimates parameters of the gamma distribution.

Example

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);

public Tuple!(T, "shape", T, "scale") gammaEstimate(T)(in GammaStatistic!T stat) 
if(isFloatingPoint!T)

Estimates parameters of the gamma distribution.

Copyright

© 2014-2015 Ilya Yaroshenko

License

MIT

Functions

gammaEstimate

Estimates parameters of the gamma distribution.

gammaEstimate

Estimates parameters of the gamma distribution.

gammaEstimate

Estimates parameters of the gamma distribution.