Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

Details

The formula for computing the χ^2 value is

χ^2 = ∑_{i=1}^2 ∑_{j=1}^k \frac{(A_{ij} - E_{ij})^2}{E_{ij}}

k = number of (no.) classes, A_{ij} = no. patterns in the ith interval, jth class, R_i = no. patterns in the jth class = ∑_{j=1}^k A_{ij}, C_j = no. patterns in the jthe class = ∑_{i=1}^2 A_{ij}, N = total no. patterns = ∑_{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 χ^2 statistic is on less the number of classes.

Value

val

χ^2 value

Author(s)

References

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

See Also

Examples

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

discretization

Data preprocessing, discretization for classification.

v1.0-1
GPL
Authors
HyunJi Kim
Initial release
2010-12-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.