Gamma parameter estimates with method of moments
parmhat = distfun_gamfitmm( data )
a matrix of doubles, the data, data>=0.
a 1-by-2 matrix of doubles, the parameters of the Gamma distribution. parmhat(1) is a, parmhat(2) is b.
Estimates the parameters of the Gamma distribution with method of moments. In other words, finds the parameters so that the mean and variance of the distribution are equal to the empirical mean and empirical variance of the data.
The implementation is based on direct inversion of the moments.
// Samples from Gamma distribution with // a=12 and b=42 data = [ 547.53259 347.58207 539.14939 342.82908 508.80556 386.28445 420.16239 725.67277 409.08739 726.20491 ] parmhat = distfun_gamfitmm(data) a=parmhat(1); b=parmhat(2); // Compare the (mean,variance) of the // distribution against the data : // must be equal. [M,V]=distfun_gamstat(a,b) M_data=mean(data) V_data=variance(data) | ![]() | ![]() |