gamfit

Gamma parameter estimates

Syntax

phat = gamfit(data)
[phat,pci] = gamfit(data)
[phat,pci] = gamfit(data,alpha)
[...] = gamfit(data,alpha,censoring,freq,options)

Description

phat = gamfit(data) returns the maximum likelihood estimates (MLEs) for the parameters of the gamma distribution given the data in vector data.

[phat,pci] = gamfit(data) returns MLEs and 95% percent confidence intervals. The first row of pci is the lower bound of the confidence intervals; the last row is the upper bound.

[phat,pci] = gamfit(data,alpha) returns 100(1 - alpha)% confidence intervals. For example, alpha = 0.01 yields 99% confidence intervals.

[...] = gamfit(data,alpha,censoring) accepts a Boolean vector of the same size as data that is 1 for observations that are right-censored and 0 for observations that are observed exactly.

[...] = gamfit(data,alpha,censoring,freq) accepts a frequency vector of the same size as data. freq typically contains integer frequencies for the corresponding elements in data, but may contain any nonnegative values.

[...] = gamfit(data,alpha,censoring,freq,options) accepts a structure, options, that specifies control parameters for the iterative algorithm the function uses to compute maximum likelihood estimates. The gamma fit function accepts an options structure which can be created using the function statset. Enter statset('gamfit') to see the names and default values of the parameters that gamfit accepts in the options structure.

Examples

Fit a gamma distribution to random data generated from a specified gamma distribution:

a = 2; b = 4;
data = gamrnd(a,b,100,1);

[p,ci] = gamfit(data)
p =
2.1990  3.7426
ci =
1.6840  2.8298
2.7141  4.6554

References

 Hahn, Gerald J., and S. S. Shapiro. Statistical Models in Engineering. Hoboken, NJ: John Wiley & Sons, Inc., 1994, p. 88.