Learn R Programming

alR (version 2.2.0)

bhatt.test: Bhattacharryya test for comparing two samples.

Description

Use the multinomial distribution to test the hypothesis that two samples come from the same distribution.

Usage

bhatt.test(y, x, k)

Arguments

y, x

Samples to be compared.

k

Number of proportions.

Value

bat.test: A list with the following components:

  • df=2*k: where k is the number of proportions used.

  • y.prop, x.prop: Vectors of proportions.

  • D2: Measure of divergence between samples.

  • test.stat: The test statistic for the Bhattacharrayya test.

  • p.value: The p-value of the test.

Details

It is assumed that the two samples come from the same kernel density distribution. The support of the KDE of the first sample is divided into \(k\) equally spaced quantiles, and then compared to the corresponding proportions of the second.

Examples

Run this code
# NOT RUN {
y <- rnorm(1000)
x <- rnorm(1000)
bhatt.test(y,x,10)

# }

Run the code above in your browser using DataLab