A function to compute the Chi-2 statistics

Chi2(c1, c2)

Arguments

c1

a vector containing the labels of the first classification. Must be a vector of characters, integers, numerics, or a factor, but not a list.

c2

a vector containing the labels of the second classification.

Value

a scalar with the chi-square statistics.

See also

Examples

data(iris)
cl <- cutree(hclust(dist(iris[,-5])), 4)
Chi2(cl,iris$Species)
#> [1] 209.1143