gamfit

Fit a gamma distribution to a data sample.

Syntax

[ahat,bhat,aci,bci]=gamfit(x)

Inputs

x
Data sample.
Type: double
Dimension: vector

Outputs

ahat
An estimate of the shape parameter a.
bhat
An estimate of the scale parameter b.
aci
A confidence interval for a. A two-element vector containing the lower and upper bounds of the interval.
bci
A confidence interval for b. A two-element vector containing the lower and upper bounds of the interval.

Example

x = [9 12.88 6.56 12.4 1.72 14.38 9.55 8.48 3.76 11.6 6.7 29.14 9.76 13.2 19.95 11.77
 8.47 7.23 7.36 7.24]
[ahat,bhat,aci,bci] = gamfit(x)
ahat = 3.5765
bhat = 2.9519
aci = [Matrix] 2 x 1
1.9763
6.4724
bci = [Matrix] 2 x 1
1.5615
5.5805

Comments

The function uses maximum likelihood estimation with 95% confidence intervals.