chiSq {discretization}R Documentation

Auxiliary function for discretization using Chi-square statistic

Description

This function is required to perform the discretization based on Chi-square statistic( CACC, Ameva, ChiMerge, Chi2, Modified Chi2, Extended Chi2).

Usage

chiSq(tb)

Arguments

tb

a vector of observed frequencies

Details

The formula for computing the χ2\chi^2 value is

χ2=i=12j=1k(AijEij)2Eij\chi^2 = \sum_{i=1}^2 \sum_{j=1}^k \frac{(A_{ij} - E_{ij})^2}{E_{ij}}

k=k = number of (no.) classes, Aij=A_{ij} = no. patterns in the iith interval, jjth class, Ri=R_i = no. patterns in the jjth class = j=1kAij\sum_{j=1}^k A_{ij}, Cj=C_j = no. patterns in the jjthe class = i=12Aij\sum_{i=1}^2 A_{ij}, N=N = total no. patterns = i=12Rij\sum_{i=1}^2 R_ij, Eij=E_{ij} = expected frequency of Aij=RiCj/NA_{ij} = R_i * C_j /N. If either RiR_i or CjC_j is 0, EijE_{ij} is set to 0.1. The degree of freedom of the χ2\chi^2 statistic is on less the number of classes.

Value

val

χ2\chi^2 value

Author(s)

HyunJi Kim polaris7867@gmail.com

References

Kerber, R. (1992). ChiMerge : Discretization of numeric attributes, In Proceedings of the Tenth National Conference on Artificial Intelligence, 123–128.

See Also

cacc, ameva, chiM, chi2, modChi2 and extendChi2.

Examples

#----Calulate Chi-Square
b=c(2,4,1,2,5,3)
m=matrix(b,ncol=3)
chiSq(m)
chisq.test(m)$statistic

[Package discretization version 1.0-1.1 Index]