Learn R Programming

HHG (version 1.1)

hhg.example.datagen: A set of example data generators used to demonstrate the HHG test.

Description

Six examples (Circle, Diamond, Parabola, 2Parabolas, W, 4indclouds) are taken from Newton's introduction to the discussion of the Energy Test in The Annals of Applied Statistics (see references). These are simple univariate dependence structures (or independence in the latter case) used to demonstrate the more general test of independece. The remaining examples (TwoClassUniv, FourClassUniv, TwoClassMultiv) generate data suitable for demonstrating the k-sample test (and in particular the two-sample test).

Usage

hhg.example.datagen(n, example)

Arguments

n
The desired sample size
example
The choice of example

Value

  • For example in {Circle, Diamond, Parabola, 2Parabolas, W, and 4indclouds}, a matrix of two rows is returned, one row per variable. We would like to test whether the two variables are statistically independent. When example is one of {TwoClassUniv, FourClassUniv, TwoClassMultiv}, a list is returned with elements x and y. y is a vector with values either 0 or 1 (for TwoClassUniv and TwoClassMultiv) or in 0:3 for (for FourClassUniv). x is a real valued random variable (TwoClassUniv and FourClassUniv) or vector (TwoClassMultiv) which is not independent of y.

References

Newton, M.A. (2009), Introducing the discussion paper by Szekely and Rizzo, Annals of applied statistics, 3 (4), 1233-1235.

Examples

Run this code
X = hhg.example.datagen(50, 'Diamond')
plot(X[1,], X[2,])

X = hhg.example.datagen(50, 'FourClassUniv')
plot(X)

Run the code above in your browser using DataLab