Fits a Gamma distribution to a random sample of positive real numbers using Villasenor and Gonzalez-Estrada (2015) parameter estimators.
gamma_fit(x)
a numeric data vector containing a random sample of positive real numbers.
Shape and scale parameter estimates.
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.
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
gamma_test
for testing the Gamma distribution hypothesis.
# 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