Type: | Package |
Title: | Goodness-of-Fit Tests for the Gamma Distribution |
Version: | 1.0 |
Maintainer: | Bruno Ebner <bruno.ebner@kit.edu> |
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>. |
License: | CC BY 4.0 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.0.2 |
Depends: | R (≥ 3.5.0) |
NeedsCompilation: | no |
Packaged: | 2020-04-24 17:12:44 UTC; ebner |
Author: | Lucas Butsch [aut], Bruno Ebner [aut, cre], Steffen Betsch [aut] |
Repository: | CRAN |
Date/Publication: | 2020-04-29 14:40:05 UTC |
statistic of the Anderson-Darling goodness-of-fit test for the gamma family
Description
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
.
Usage
AD(data, k_estimator)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
Details
The Anderson-Darling test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
Value
value of the test statistic
References
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
Examples
X=stats::rgamma(20,3,6)
AD(X,k_estimator=gamma_est(X)[1])
statistic of the Betsch-Ebner test
Description
This function computes the statistic of the goodness-of-fit test for the gamma family due to Betsch and Ebner (2019).
Usage
BE(data, k_estimator, a)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
a |
positive tuning parameter. |
Details
The test is of weighted L^2
type and uses a characterization of the distribution function of the gamma distribution. Values of k_estimator
are found by gamma_est
.
Value
value of the test statistic
References
Betsch, S., Ebner, B. (2019) "A new characterization of the Gamma distribution and associated goodness of fit tests", Metrika, 82(7):779-806. DOI
Examples
X=stats::rgamma(20,3,6)
BE(X,k_estimator=gamma_est(X)[1],a=2)
statistic of the Cramer-von Mises goodness-of-fit test for the gamma family
Description
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
.
Usage
CM(data, k_estimator)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
Details
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
value of the test statistic
References
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
Examples
X=stats::rgamma(20,3,6)
CM(X,k_estimator=gamma_est(X)[1])
statistic of the first Henze-Meintanis-Ebner goodness-of-fit test for the gamma family
Description
This function computes the goodness-of-fit test statistic for the gamma family due to the first test in Henze, Meintanis and Ebner (2012).
Usage
HME1(data, k_estimator, a = 1)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
a |
positive tuning parameter. |
Details
The test statistic is of weighted L^2
type and uses a characterization of the distribution function of the gamma distribution.
Value
value of the test statistic
References
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
Examples
X=stats::rgamma(20,3,6)
HME1(X,k_estimator=gamma_est(X)[1],a=1)
statistic of the second Henze-Meintanis-Ebner goodness-of-fit test for the gamma family
Description
This function computes the goodness-of-fit test statistic for the gamma family due to the second test in Henze, Meintanis and Ebner (2012).
Usage
HME2(data, k_estimator, a = 4)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
a |
positive tuning parameter. |
Details
The test statistic is of weighted L^2
type and uses a characterization of the distribution function of the gamma distribution.
Value
value of the test statistic
References
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
Examples
X=stats::rgamma(20,3,6)
HME2(X,k_estimator=gamma_est(X)[1],a=1)
statistic of the Kolmogorov-Smirnov goodness-of-fit test for the gamma family
Description
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
.
Usage
KS(data, k_estimator)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
Details
The Kolmogorov-Smirnov test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
Value
value of the test statistic
References
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
Examples
X=stats::rgamma(20,3,6)
KS(X,k_estimator=gamma_est(X)[1])
statistic of the Watson goodness-of-fit test for the gamma family
Description
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
.
Usage
WA(data, k_estimator)
Arguments
data |
a vector of positive numbers. NOTE: |
k_estimator |
value of the estimated |
Details
The Watson test is computed as described in Henze et. al. (2012). Values of k_estimator
are found by gamma_est
.
Value
value of the test statistic
References
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
Examples
X=stats::rgamma(20,3,6)
WA(X,k_estimator=gamma_est(X)[1])
bootstrap critical value of statistic
Description
bootstrap critical value of statistic
Usage
crit.values(
samplesize,
statistic,
tuning = NULL,
k_estimator,
boot.param = 500,
alpha = 0.05
)
Arguments
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 |
Value
returns the critical value for the goodness-of-fit test using the statistic
.
Examples
crit.values(samplesize=20,statistic=HME1,tuning=1,k_estimator=2,boot.param=100,alpha=0.05)
Maximum-likelihood estimation of parameters for the gamma distribution
Description
The maximum-likelihood estimators for the shape
and scale
parameters of a gamma distribution are computed due to the method of Bhattacharya (2001).
Usage
gamma_est(data)
Arguments
data |
vector of positive valued observations |
Value
returns a bivariate vector containing (shape
,scale
) estimated parameter vector.
References
Bhattacharya, B. (2001) "Testing equality of scale parameters against restricted alternatives for m \ge 3
gamma distributions with unknown common shape parameter". Journal of Statistical Computation and Simulations, 69(4):353-368, DOI
Examples
gamma_est(stats::rgamma(100,shape=3,scale=6))
Print method for tests of Gamma distribution
Description
Printing objects of class "gofgamma".
Usage
## S3 method for class 'gofgamma'
print(x, ...)
Arguments
x |
object of class "gofgamma". |
... |
further arguments to be passed to or from methods. |
Details
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.
Value
the argument x, invisibly, as for all print methods.
Examples
print(test.BE(rgamma(20,1)))
The Anderson-Darling goodness-of-fit test for the gamma family
Description
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.
Usage
test.AD(data, boot = 500, alpha = 0.05)
Arguments
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
Details
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
.
Value
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.
References
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
Examples
test.AD(stats::rgamma(20,3,6),boot=100)
The Betsch-Ebner goodness-of-fit test for the gamma family
Description
This function computes the goodness-of-fit test for the gamma family due to Betsch and Ebner (2019).
Usage
test.BE(data, a = 1, boot = 500, alpha = 0.05)
Arguments
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. |
Details
The test is of weighted L^2
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
.
Value
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.
References
Betsch, S., Ebner, B. (2019) "A new characterization of the Gamma distribution and associated goodness of fit tests", Metrika, 82(7):779-806. DOI
Examples
test.BE(stats::rgamma(20,3,6),boot=100)
The Cramer-von Mises goodness-of-fit test for the gamma family
Description
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.
Usage
test.CM(data, boot = 500, alpha = 0.05)
Arguments
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
Details
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
.
Value
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.
References
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
Examples
test.CM(stats::rgamma(20,3,6),boot=100)
The first Henze-Meintanis-Ebner goodness-of-fit test for the gamma family
Description
This function computes the first goodness-of-fit test for the gamma family due to Henze, Meintanis and Ebner (2012).
Usage
test.HME1(data, a = 1, boot = 500, alpha = 0.05)
Arguments
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. |
Details
The test is of weighted L^2
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
.
Value
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.
References
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
Examples
test.HME1(stats::rgamma(20,3,6),boot=100)
The second Henze-Meintanis-Ebner goodness-of-fit test for the gamma family
Description
This function computes the second goodness-of-fit test for the gamma family due to Henze, Meintanis and Ebner (2012).
Usage
test.HME2(data, a = 4, boot = 500, alpha = 0.05)
Arguments
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. |
Details
The test is of weighted L^2
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
.
Value
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.
References
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
Examples
test.HME2(stats::rgamma(20,3,6),boot=100)
The Kolmogorov-Smirnov goodness-of-fit test for the gamma family
Description
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.
Usage
test.KS(data, boot = 500, alpha = 0.05)
Arguments
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
Details
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
.
Value
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.
References
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
Examples
test.KS(stats::rgamma(20,3,6),boot=100)
The Watson goodness-of-fit test for the gamma family
Description
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.
Usage
test.WA(data, boot = 500, alpha = 0.05)
Arguments
data |
a vector of positive numbers. |
boot |
number of bootstrap iterations used to obtain critical value. |
alpha |
level of significance of the test. |
Details
The Watson test is computed as described in Henze et. al. (2012). Critical values are obtained by a parametric bootstrap procedure, see crit.values
.
Value
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.
References
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
Examples
test.WA(stats::rgamma(20,3,6),boot=100)