Computes the Hankel test statistic and its empirically standardized version in the case that *ν* equals the exponential distribution (see details below). Optionally, simple computations of the p-value and the critical value for a selectable significance level and number of replicates are provided.

1 2 3 | ```
hankel.test(x,y,standardized=FALSE,replicates=500,
calcCritVal=FALSE,calcPVal=TRUE,sigLevel=0.95,
probMeasure="exp",params=list(lambda=1.0))
``` |

`x` |
First set of observations as vector. |

`y` |
Second set of observations as vector. |

`standardized` |
Boolean variable which indicates whether the empirically standardized version of the test statistic is supposed to be applied. The default is |

`probMeasure` |
The family of probability measures which is supposed to be applied. However, only the exponential distribution has been implemented so far. |

`params` |
List of parameter which specify the probability measure |

`sigLevel` |
Significance level of the test. The default is |

`calcCritVal` |
Boolean variable which indicates whether the critical value of the test statistic for the given significance level is supposed to be computed.
The default is |

`calcPVal` |
Boolean variable which indicates whether the p-value of the statistic corresponding to the given observations is supposed to be computed. The default is |

`replicates` |
Number of bootstrap replicates for the computation of the critical value and the p-value. The default is |

The Hankel test statistic is of the Cramer- von Mises type and was proposed by L. Baringhaus, University of Hanover. It is given by

*
T_{m,n}=\frac{mn}{m+n} \int_{R_{≥ 0}}(\frac{1}{m} ∑_{i=1}^m J_0(2√{tX_i})-\frac{1}{n} ∑_{i=1}^n J_0(2√{tY_i}))^2 \,dν(t),
*

where *X_1,…,X_m,Y_1,…,Y_n* are real nonnegative random variables, * J_0* the Bessel function of the first kind of order zero and *ν* some suitable probability measure on the nonnegative half-line.

In case that *ν* equals the exponential distribution with parameter *λ >0*, an alternative expression for *T_{m,n}*, which is obtained by applying formula 6.615
of Gradstein and Ryshik (1981), is used:

*
T_{m,n}(λ)=\frac{mn}{m+n} \int_{0}^{∞} ≤ft (\frac{1}{m} ∑_{i=1}^m J_0(2√{tX_i})-\frac{1}{n} ∑_{j=1}^n J_0(2√{tY_j})\right )^2 λ \exp(-λ t)\,dt
*

*
= \frac{mn}{m+n} \bigg [\frac{1}{m^2} ∑_{i=1}^m ∑_{j=1}^m I_0(2√{X_iX_j}/λ)\hspace{0.5mm} \exp(-(X_i+X_j)/λ)
*

*
+ \frac{1}{n^2} ∑_{i=1}^n ∑_{j=1}^n I_0(2√{Y_iY_j}/λ)\hspace{0.5mm} \exp(-(Y_i+Y_j)/λ)
*

*
- \frac{2}{mn} ∑_{i=1}^m ∑_{j=1}^n I_0(2√{X_iY_j}/λ)\hspace{0.5mm} \exp(-(X_i+Y_j)/λ)\bigg ],
*

where *I_0* denotes the Bessel function of the third kind of order 0. This representation is used for the computation of the test statistic.

The empirically standardized version of the test is obtained by replacing the *X_1,…,X_m* and *Y_1,…,Y_m* by the empirically standardized variables *U_1=X_1/η_{m,n},…,U_m=X_m/η_{m,n}* and *V_1=Y_1/η_{m,n},…,V_n=Y_n/η_{m,n}*, where *η_{m,n}=\frac{1}{m+n}≤ft ( ∑_{i=1}^{m}X_i+ ∑_{j=1}^{n}Y_j\right)*, in the representation of *T_{m,n}(λ)*. For further details see Baringhaus and Kolbe (2014).

An object of class `"hankeltest"`

is returned. The following components are retrievable:

`samplesizes` |
A list containing the samplesizes. |

`statistic` |
Value of the Hankel test statistic for the given observations. |

`standardized` |
Boolean value which indicates whether the standardized version of the test was applied. |

`probMeasure` |
String value which indicates which family of probability measures was applied. |

`params` |
List of parameter which specify the applied probability measure |

`sigLevel` |
Significance level of the test. |

`pValue` |
Boostrap estimation of the p-value of the test (if computed). |

`critValue` |
Boostrap estimation of the critical value (if computed). |

`replicates` |
Number of bootstrap replicates taken for the computation of the critical value and the p-value. |

Daniel Kolbe

Baringhaus, L. and Kolbe, D. (2014). *Two-sample tests based on empirical Hankel transforms.* Statistical Papers, 10.1007/s00362-014-0599-1.

Baringhaus, L. and Taherizadeh, F. (2010).* Empirical Hankel transforms and its applications to
goodness-of-fit tests.* J. Multivariate Anal., 101:1445-14457.

Gradstein, I. and Ryshik, I. (1981). *Tables.* Harri Deutsch, Frankfurt.

1 2 3 4 5 6 7 8 9 10 11 | ```
# comparison of an uniform distribution with an weibull distribution
x<-runif(30)
y<-rweibull(50,5,0.75)
hankel.test(x,y)
# comparison of an uniform distribution with an weibull distribution
# in standardized case with parameter lambda=0.1 and replicates=1000
x<-runif(30)
y<-rweibull(50,5,0.75)
hankel.test(x,y,standardized=TRUE,params=list(lambda=0.1),replicates=1000)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.