MyNixOS website logo
Description

Statistical Inference and Sure Independence Screening via Ball Statistics.

Hypothesis tests and sure independence screening (SIS) procedure based on ball statistics, including ball divergence <doi:10.1214/17-AOS1579>, ball covariance <doi:10.1080/01621459.2018.1543600>, and ball correlation <doi:10.1080/01621459.2018.1462709>, are developed to analyze complex data in metric spaces, e.g, shape, directional, compositional and symmetric positive definite matrix data. The ball divergence and ball covariance based distribution-free tests are implemented to detecting distribution difference and association in metric spaces <doi:10.18637/jss.v097.i06>. Furthermore, several generic non-parametric feature selection procedures based on ball correlation, BCor-SIS and all of its variants, are implemented to tackle the challenge in the context of ultra high dimensional data. A fast implementation for large-scale multiple K-sample testing with ball divergence <doi: 10.1002/gepi.22423> is supported, which is particularly helpful for genome-wide association study.

Ball Statistics in R

AppVeyor Build Status CRAN Status Badge

Introduction

The fundamental problems for data mining, statistical analysis, and machine learning are:

  • whether several distributions are different?
  • whether random variables are dependent?
  • how to pick out useful variables/features from a high-dimensional data?

These issues can be tackled by using bd.test, bcov.test, and bcorsis functions in the Ball package, respectively. They enjoy following admirable advantages:

  • available for most of datasets (e.g., traditional tabular data, brain shape, functional connectome, wind direction and so on)
  • insensitive to outliers, distribution-free and model-free;
  • theoretically guaranteed and computationally efficient.

Installation

CRAN version

To install the Ball R package from CRAN, just run:

install.packages("Ball")

Github version

To install the development version from GitHub, run:

library(devtools)
install_github("Mamba413/Ball/R-package", build_vignettes = TRUE)

Windows user will need to install Rtools first.

Overview: Ball package

Three most importance functions in Ball:

bd.testbcov.testbcorsis
FeatureHypothesis testHypothesis testFeature screening
TypeTest of equal distributionsTest of (joint) independenceSIS and ISIS
Optional weight:heavy_check_mark::heavy_check_mark::heavy_check_mark:
Parallel programming:heavy_check_mark::heavy_check_mark::heavy_check_mark:
p-value:heavy_check_mark::heavy_check_mark::x:
Limit distributionTwo-sample test onlyIndependence test only:x:
Censored data:x::x::heavy_check_mark:
Interaction screening:x::x::heavy_check_mark:
GWAS optimization:x::x::heavy_check_mark:
  • SIS: Sure Independence Screening
  • ISIS: Iterative Sure Independence Screening (SIS)
  • GWAS: Genome-Wide Association Study

Quick examples

Take iris dataset as an example to illustrate how to use bd.test and bcov.test to deal with the fundamental problems mentioned above.

bd.test

virginica <- iris[iris$Species == "virginica", "Sepal.Length"]
versicolor <- iris[iris$Species == "versicolor", "Sepal.Length"]
bd.test(virginica, versicolor)

In this example, bd.test examines the assumption that Sepal.Length distributions of versicolor and virginica are equal.

If the assumption invalid, the p-value of the bd.test will be under 0.05.

In this example, the result is:

	2-sample Ball Divergence Test (Permutation)

data:  virginica and versicolor 
number of observations = 100, group sizes: 50 50
replicates = 99, weight: constant
bd.constant = 0.11171, p-value = 0.01
alternative hypothesis: distributions of samples are distinct

The R output shows that p-value is under 0.05. Consequently, we can conclude that the Sepal.Length distribution of versicolor and virginica are distinct.

bcov.test

sepal <- iris[, c("Sepal.Width", "Sepal.Length")]
petal <- iris[, c("Petal.Width", "Petal.Length")]
bcov.test(sepal, petal)

In this example, bcov.test investigates whether width or length of petal is associated with width and length of sepal. If the dependency really exists, the p-value of the bcov.test will be under 0.05. In this example, the result is show to be:

	Ball Covariance test of independence (Permutation)

data:  sepal and petal
number of observations = 150
replicates = 99, weight: constant
bcov.constant = 0.0081472, p-value = 0.01
alternative hypothesis: random variables are dependent

Therefore, the relationship between width and length of sepal and petal exists.

bcorsis

We generate a dataset and demonstrate the usage of bcorsis function as follow.

## simulate a ultra high dimensional dataset:
set.seed(1)
n <- 150
p <- 3000
x <- matrix(rnorm(n * p), nrow = n)
error <- rnorm(n)
y <- 3 * x[, 1] + 5 * (x[, 3])^2 + error

## BCor-SIS procedure:
res <- bcorsis(y = y, x = x)
head(res[["ix"]], n = 5)

In this example, the result is:

# [1]    3    1 1601   20  429

The bcorsis result shows that the first and the third variable are the two most important variables in 3000 explanatory variables which is consistent to the simulation settings.

Citation

If you use Ball or reference our vignettes in a presentation or publication, we would appreciate citations of our package.

Zhu J, Pan W, Zheng W, Wang X (2021). “Ball: An R Package for Detecting Distribution Difference and Association in Metric Spaces.” Journal of Statistical Software, 97(6), 1–31. doi: 10.18637/jss.v097.i06.

Here is the corresponding Bibtex entry

@Article{,
  title = {{Ball}: An {R} Package for Detecting Distribution Difference and Association in Metric Spaces},
  author = {Jin Zhu and Wenliang Pan and Wei Zheng and Xueqin Wang},
  journal = {Journal of Statistical Software},
  year = {2021},
  volume = {97},
  number = {6},
  pages = {1--31},
  doi = {10.18637/jss.v097.i06},
}

Reference

Bug report

If you find any bugs, or if you experience any crashes, please report to us. If you have any questions just ask, we won't bite. Open an issue or send an email to Jin Zhu at [email protected].

Metadata

Version

1.3.13

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows