HK2 function

The second Henze-Klar test statistic

The second Henze-Klar test statistic

This function computes the test statistic of the second goodness-of-fit test for the inverse Gaussian family due to Henze and Klar (2002).

HK2(data)

Arguments

  • data: a vector of positive numbers.

Returns

value of the test statistic.

Details

The representation of the second Henze-Klar test statistic used for computation (a=0)(a = 0) is given by:

HKn,0(2)=1nj,k=1nZjk12j=1nZj1{1πφ^n2Zjerfce(φ^n1/2(Zj+1)(2Zj)1/2)}+n1+2φ^n4φ^n HK_{n,0}^{(2)} = \frac{1}{n} \sum_{j,k=1}^{n} Z_{jk}^{-1} - 2 \sum_{j=1}^{n} Z_j^{-1} \left\{ 1 - \sqrt{\frac{\pi \hat{\varphi}_n}{2 Z_j}} \, \mathrm{erfce} \left( \frac{\hat{\varphi}_n^{1/2} (Z_j + 1)}{(2 Z_j)^{1/2}} \right) \right\} + n\frac{1 + 2 \hat{\varphi}_n}{4 \hat{\varphi}_n}

with φ^n=λ^nμ^n\hat{\varphi}_n = \frac{\hat{\lambda}_n}{\hat{\mu}_n}, where μ^n,λ^n\hat{\mu}_n,\hat{\lambda}_n are the maximum likelihood estimators for μ\mu and λ\lambda, respectively, the parameters of the inverse Gaussian distribution. Furthermore Zjk=(Yj+Yk)Z_{jk} = (Y_j + Y_k) and Zj=YjZ_j = Y_j, where Yi=Xiμ^nY_i = \frac{X_i}{\hat{\mu}_n} for (Xi)i=1,...,n(X_i)_{i = 1,...,n}, a sequence of independent observations of a nonnegative random variable XX. To ensure numerical stability of the implementation the exponentially scaled complementary error function erfce(x)\text{erfce}(x) is used: erfce(x)=exp(x2)erfc(x)\text{erfce}(x) = \exp{(x^2)}\text{erfc}(x), with erfc(x)=2xexp(t2)dt/π\text{erfc}(x) = 2\int_x^\infty \exp{(-t^2)}dt/\pi. The null hypothesis is rejected for large values of the test statistic HKn,a(2)HK_{n,a}^{(2)}.

Examples

HK2(rmutil::rinvgauss(20,2,1))

References

Henze, N. and Klar, B. (2002) "Goodness-of-fit tests for the inverse Gaussian distribution based on the empirical Laplace transform", Annals of the Institute of Statistical Mathematics, 54(2):425-444. tools:::Rd_expr_doi("https://doi.org/10.1023/A:1022442506681")

  • Maintainer: Bruno Ebner
  • License: CC BY 4.0
  • Last published: 2024-11-01

Useful links