Learn R Programming

MissMech (version 1.0.4)

AndersonDarling: K-Sample Anderson Darling Test

Description

This is a non-parametric K-sample test that tests equality of distribution of a variable between k populations based on samples from each of the populations.

Usage

AndersonDarling(data, number.cases)

Value

pn

The test's p-value.

adk.all

The Anderson Darling test statistic corresponding to each group.

adl

The sum of elements of adk.all.

var.sdk

The variance of the finite sample distribution of the Anderson Darling test statistic under the null.

Arguments

data

A single vector consisting of concatenation of the k samples data being used for the test.

number.cases

A vector consisting of the number of cases in samples 1, 2, ..., k, respectively.

Author

Mortaza Jamshidian, Siavash Jalal, and Camden Jansen

Details

The data is a vector including all the k samples to be used for the test. The j-th element of number.cases is the number of cases in sample j (included in data), for j= 1,...,k.

References

Scholz, F.W. and Stephens, M.A. (1987). ''K-Sample Anderson-Darling Tests,''Journal of the American Statistical Association, 82, 918-924, tools:::Rd_expr_doi("10.2307/2288805").

Examples

Run this code
#---- Example 1
set.seed(50)
n1 <- 30
n2 <- 45
n3 <- 60
v1 <- rnorm(n1)
v2 <- runif(n2)
v3 <- rnorm(n3, 2, 3)
AndersonDarling(data = c(v1, v2, v3), number.cases=c(n1, n2, n3))

#---- Example 2
set.seed(50)
n1 <- 30
n2 <- 45
n3 <- 60
v1 <- rt(n1,4)
v2 <- rt(n2,4)
v3 <- rt(n3,4)
AndersonDarling(data=c(v1, v2, v3), number.cases=c(n1, n2, n3))

Run the code above in your browser using DataLab