HK2 {gofIG} | R Documentation |
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)
data |
a vector of positive numbers. |
The representation of the second Henze-Klar test statistic used for computation (a = 0)
is given by:
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 \hat{\varphi}_n = \frac{\hat{\lambda}_n}{\hat{\mu}_n}
, where \hat{\mu}_n,\hat{\lambda}_n
are the maximum likelihood estimators for \mu
and \lambda
, respectively, the parameters of the inverse Gaussian distribution.
Furthermore Z_{jk} = (Y_j + Y_k)
and Z_j = Y_j
, where Y_i = \frac{X_i}{\hat{\mu}_n}
for (X_i)_{i = 1,...,n}
, a sequence of independent observations of a nonnegative random variable X
.
To ensure numerical stability of the implementation the exponentially scaled complementary error function \text{erfce}(x)
is used: \text{erfce}(x) = \exp{(x^2)}\text{erfc}(x)
, with \text{erfc}(x) = 2\int_x^\infty \exp{(-t^2)}dt/\pi
.
The null hypothesis is rejected for large values of the test statistic HK_{n,a}^{(2)}
.
value of the test statistic.
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. doi:10.1023/A:1022442506681
HK2(rmutil::rinvgauss(20,2,1))