Title: | Goodness-of-Fit Tests for the Gamma Distribution |
---|---|
Description: | We implement various classical tests for the composite hypothesis of testing the fit to the family of gamma distributions as the Kolmogorov-Smirnov test, the Cramer-von Mises test, the Anderson Darling test and the Watson test. For each test a parametric bootstrap procedure is implemented, as considered in Henze, Meintanis & Ebner (2012) <doi:10.1080/03610926.2010.542851>. The recent procedures presented in Henze, Meintanis & Ebner (2012) <doi:10.1080/03610926.2010.542851> and Betsch & Ebner (2019) <doi:10.1007/s00184-019-00708-7> are implemented. Estimation of parameters of the gamma law are implemented using the method of Bhattacharya (2001) <doi:10.1080/00949650108812100>. |
Authors: | Lucas Butsch [aut], Bruno Ebner [aut, cre], Steffen Betsch [aut] |
Maintainer: | Bruno Ebner <[email protected]> |
License: | CC BY 4.0 |
Version: | 1.0 |
Built: | 2025-03-03 04:32:51 UTC |
Source: | https://github.com/cran/gofgamma |
This function computes the goodness-of-fit test statistic for the gamma family in the spirit of Anderson and Darling. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test, see crit.values
.
AD(data, k_estimator)
AD(data, k_estimator)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
The Anderson-Darling test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
value of the test statistic
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
X=stats::rgamma(20,3,6) AD(X,k_estimator=gamma_est(X)[1])
X=stats::rgamma(20,3,6) AD(X,k_estimator=gamma_est(X)[1])
This function computes the statistic of the goodness-of-fit test for the gamma family due to Betsch and Ebner (2019).
BE(data, k_estimator, a)
BE(data, k_estimator, a)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
a |
positive tuning parameter. |
The test is of weighted type and uses a characterization of the distribution function of the gamma distribution. Values of
k_estimator
are found by gamma_est
.
value of the test statistic
Betsch, S., Ebner, B. (2019) "A new characterization of the Gamma distribution and associated goodness of fit tests", Metrika, 82(7):779-806. DOI
X=stats::rgamma(20,3,6) BE(X,k_estimator=gamma_est(X)[1],a=2)
X=stats::rgamma(20,3,6) BE(X,k_estimator=gamma_est(X)[1],a=2)
This function computes the goodness-of-fit test statistic for the gamma family in the spirit of Cramer and von Mises. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test, see crit.values
.
CM(data, k_estimator)
CM(data, k_estimator)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
The Cramér-von Mises test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
value of the test statistic
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
X=stats::rgamma(20,3,6) CM(X,k_estimator=gamma_est(X)[1])
X=stats::rgamma(20,3,6) CM(X,k_estimator=gamma_est(X)[1])
bootstrap critical value of statistic
crit.values( samplesize, statistic, tuning = NULL, k_estimator, boot.param = 500, alpha = 0.05 )
crit.values( samplesize, statistic, tuning = NULL, k_estimator, boot.param = 500, alpha = 0.05 )
samplesize |
number of observations in the sample |
statistic |
test statistic to be used |
tuning |
tuning parameter used for the test statistic ( |
k_estimator |
value of the estimated |
boot.param |
number of bootstrap iterations |
alpha |
significance level of the test |
returns the critical value for the goodness-of-fit test using the statistic
.
crit.values(samplesize=20,statistic=HME1,tuning=1,k_estimator=2,boot.param=100,alpha=0.05)
crit.values(samplesize=20,statistic=HME1,tuning=1,k_estimator=2,boot.param=100,alpha=0.05)
The maximum-likelihood estimators for the shape
and scale
parameters of a gamma distribution are computed due to the method of Bhattacharya (2001).
gamma_est(data)
gamma_est(data)
data |
vector of positive valued observations |
returns a bivariate vector containing (shape
,scale
) estimated parameter vector.
Bhattacharya, B. (2001) "Testing equality of scale parameters against restricted alternatives for gamma distributions with unknown common shape parameter". Journal of Statistical Computation and Simulations, 69(4):353-368, DOI
gamma_est(stats::rgamma(100,shape=3,scale=6))
gamma_est(stats::rgamma(100,shape=3,scale=6))
This function computes the goodness-of-fit test statistic for the gamma family due to the first test in Henze, Meintanis and Ebner (2012).
HME1(data, k_estimator, a = 1)
HME1(data, k_estimator, a = 1)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
a |
positive tuning parameter. |
The test statistic is of weighted type and uses a characterization of the distribution function of the gamma distribution.
value of the test statistic
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
X=stats::rgamma(20,3,6) HME1(X,k_estimator=gamma_est(X)[1],a=1)
X=stats::rgamma(20,3,6) HME1(X,k_estimator=gamma_est(X)[1],a=1)
This function computes the goodness-of-fit test statistic for the gamma family due to the second test in Henze, Meintanis and Ebner (2012).
HME2(data, k_estimator, a = 4)
HME2(data, k_estimator, a = 4)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
a |
positive tuning parameter. |
The test statistic is of weighted type and uses a characterization of the distribution function of the gamma distribution.
value of the test statistic
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
X=stats::rgamma(20,3,6) HME2(X,k_estimator=gamma_est(X)[1],a=1)
X=stats::rgamma(20,3,6) HME2(X,k_estimator=gamma_est(X)[1],a=1)
This function computes the goodness-of-fit test statistic for the gamma family in the spirit of Kolmogorov and Smirnov. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test, see crit.values
.
KS(data, k_estimator)
KS(data, k_estimator)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
The Kolmogorov-Smirnov test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
value of the test statistic
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
X=stats::rgamma(20,3,6) KS(X,k_estimator=gamma_est(X)[1])
X=stats::rgamma(20,3,6) KS(X,k_estimator=gamma_est(X)[1])
Printing objects of class "gofgamma".
## S3 method for class 'gofgamma' print(x, ...)
## S3 method for class 'gofgamma' print(x, ...)
x |
object of class "gofgamma". |
... |
further arguments to be passed to or from methods. |
A gofgamma
object is a named list of numbers and character string, supplemented with test
(the name of the teststatistic). test
is displayed as a title.
The remaining elements are given in an aligned "name = value" format.
the argument x, invisibly, as for all print methods.
print(test.BE(rgamma(20,1)))
print(test.BE(rgamma(20,1)))
This function computes the goodness-of-fit test for the gamma family in the spirit of Anderson and Darling. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test.
test.AD(data, boot = 500, alpha = 0.05)
test.AD(data, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The Anderson-Darling test is computed as described in Henze et. al. (2012). Critical values are obtained by a parametric bootstrap procedure, see crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
test.AD(stats::rgamma(20,3,6),boot=100)
test.AD(stats::rgamma(20,3,6),boot=100)
This function computes the goodness-of-fit test for the gamma family due to Betsch and Ebner (2019).
test.BE(data, a = 1, boot = 500, alpha = 0.05)
test.BE(data, a = 1, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
a |
positive tuning parameter. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The test is of weighted type and uses a characterization of the distribution function of the gamma distribution. Critical values are obtained by a parametric bootstrap procedure, see
crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Betsch, S., Ebner, B. (2019) "A new characterization of the Gamma distribution and associated goodness of fit tests", Metrika, 82(7):779-806. DOI
test.BE(stats::rgamma(20,3,6),boot=100)
test.BE(stats::rgamma(20,3,6),boot=100)
This function computes the goodness-of-fit test for the gamma family in the spirit of Cramer and von Mises. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test.
test.CM(data, boot = 500, alpha = 0.05)
test.CM(data, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The Cramér-von Mises test is computed as described in Henze et. al. (2012). Critical values are obtained by a parametric bootstrap procedure, see crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
test.CM(stats::rgamma(20,3,6),boot=100)
test.CM(stats::rgamma(20,3,6),boot=100)
This function computes the first goodness-of-fit test for the gamma family due to Henze, Meintanis and Ebner (2012).
test.HME1(data, a = 1, boot = 500, alpha = 0.05)
test.HME1(data, a = 1, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
a |
positive tuning parameter. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The test is of weighted type and uses a characterization of the distribution function of the gamma distribution. Critical values are obtained by a parametric bootstrap procedure, see
crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
test.HME1(stats::rgamma(20,3,6),boot=100)
test.HME1(stats::rgamma(20,3,6),boot=100)
This function computes the second goodness-of-fit test for the gamma family due to Henze, Meintanis and Ebner (2012).
test.HME2(data, a = 4, boot = 500, alpha = 0.05)
test.HME2(data, a = 4, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
a |
positive tuning parameter. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The test is of weighted type and uses a characterization of the distribution function of the gamma distribution. Critical values are obtained by a parametric bootstrap procedure, see
crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
test.HME2(stats::rgamma(20,3,6),boot=100)
test.HME2(stats::rgamma(20,3,6),boot=100)
This function computes the goodness-of-fit test for the gamma family in the spirit of Kolmogorov and Smirnov. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test.
test.KS(data, boot = 500, alpha = 0.05)
test.KS(data, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The Kolmogorov Smirnov test is computed as described in Henze et. al. (2012). Critical values are obtained by a parametric bootstrap procedure, see crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
test.KS(stats::rgamma(20,3,6),boot=100)
test.KS(stats::rgamma(20,3,6),boot=100)
This function computes the goodness-of-fit test for the gamma family in the spirit of Watson. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test.
test.WA(data, boot = 500, alpha = 0.05)
test.WA(data, boot = 500, alpha = 0.05)
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
The Watson test is computed as described in Henze et. al. (2012). Critical values are obtained by a parametric bootstrap procedure, see crit.values
.
a list containing the value of the test statistic, the approximated critical value and a test decision on the significance level alpha
:
$T.value
the value of the test statistic.
$cv
the approximated critical value.
$par.est
number of points used in approximation.
$Decision
the comparison of the critical value and the value of the test statistic.
$sig.level
level of significance chosen.
$boot.run
number of bootstrap iterations.
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
test.WA(stats::rgamma(20,3,6),boot=100)
test.WA(stats::rgamma(20,3,6),boot=100)
This function computes the goodness-of-fit test statistic for the gamma family in the spirit of Watson. Note that this tests the composite hypothesis of fit to the family of gamma distributions, i.e. a bootstrap procedure is implemented to perform the test, see crit.values
.
WA(data, k_estimator)
WA(data, k_estimator)
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
The Watson test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
value of the test statistic
Henze, N., Meintanis, S.G., Ebner, B. (2012) "Goodness-of-fit tests for the Gamma distribution based on the empirical Laplace transform". Communications in Statistics - Theory and Methods, 41(9): 1543-1556. DOI
X=stats::rgamma(20,3,6) WA(X,k_estimator=gamma_est(X)[1])
X=stats::rgamma(20,3,6) WA(X,k_estimator=gamma_est(X)[1])