Last data update: 2014.03.03

R: A set of example data generators used to demonstrate the HHG...
hhg.example.datagenR Documentation

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 (2009). These are simple univariate dependence structures (or independence, in the latter case) used to demonstrate the tests 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. Columns are i.i.d. samples. Given these data, we would like to test whether the two variables are statistically independent. Except for the 4indclouds case, all examples in fact have variables that are dependent. 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.

Author(s)

Shachar Kaufman and Ruth Heller

References

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

Examples

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

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(HHG)
HHG package for non parametric tests of independence and equality of distributions.
type vignette('HHG') or ?HHG for documentation, examples and a quickstart guide.
use suppressPackageStartupMessages(library(HHG)) to suppress this message.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HHG/hhg.example.datagen.Rd_%03d_medium.png", width=480, height=480)
> ### Name: hhg.example.datagen
> ### Title: A set of example data generators used to demonstrate the HHG
> ###   test.
> ### Aliases: hhg.example.datagen
> 
> ### ** Examples
> 
> X = hhg.example.datagen(50, 'Diamond')
> plot(X[1,], X[2,])
> 
> X = hhg.example.datagen(50, 'FourClassUniv')
> plot(X)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>