Learn R Programming

goft (version 1.3.6)

gamma_fit: Fitting the Gamma distribution to data

Description

Fits a Gamma distribution to a random sample of positive real numbers using Villasenor and Gonzalez-Estrada (2015) parameter estimators.

Usage

gamma_fit(x)

Arguments

x

a numeric data vector containing a random sample of positive real numbers.

Value

Shape and scale parameter estimates.

Details

The Gamma distribution with shape and scale parameters is considered. The scale parameter is estimated by the unbiased sample estimator of the covariance of X and log(X). The shape parameter is estimated by the ratio of the sample mean of X and the scale parameter estimator.

References

Villasenor, J.A. and Gonzalez-Estrada, E. (2015). A variance ratio test of fit for Gamma distributions. Statistics and Probability Letters, 96 1, 281-286. http://dx.doi.org/10.1016/j.spl.2014.10.001

See Also

gamma_test for testing the Gamma distribution hypothesis.

Examples

Run this code
# NOT RUN {
# Fitting a gamma distribution to the logarithm of variable Loss contained in
# the danishuni data set 
library(fitdistrplus)
data(danishuni) 
logLoss <- log(danishuni$Loss)   # logarithm of Loss variable
logLoss <- logLoss[logLoss > 0]  # observations > 0
gamma_fit(logLoss)                 
# }

Run the code above in your browser using DataLab