discretization (version 1.0-1)

chiSq: 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

Value

val

\(\chi^2\) value

Details

The formula for computing the \(\chi^2\) value is $$\chi^2 = \sum_{i=1}^2 \sum_{j=1}^k \frac{(A_{ij} - E_{ij})^2}{E_{ij}}$$

\(k =\) number of (no.) classes, \(A_{ij} =\) no. patterns in the \(i\)th interval, \(j\)th class, \(R_i =\) no. patterns in the \(j\)th class = \(\sum_{j=1}^k A_{ij}\), \(C_j =\) no. patterns in the \(j\)the class = \(\sum_{i=1}^2 A_{ij}\), \(N =\) total no. patterns = \(\sum_{i=1}^2 R_ij\), \(E_{ij} =\) expected frequency of \(A_{ij} = R_i * C_j /N\). If either \(R_i\) or \(C_j\) is 0, \(E_{ij}\) is set to 0.1. The degree of freedom of the \(\chi^2\) statistic is on less the number of classes.

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

Run this code
# NOT RUN {
#----Calulate Chi-Square
b=c(2,4,1,2,5,3)
m=matrix(b,ncol=3)
chiSq(m)
chisq.test(m)$statistic
# }

Run the code above in your browser using DataLab