# Example 1. Asymptotic functional chi-square test
x <- matrix(c(20,0,20,0,20,0,5,0,5), 3)
fun.chisq.test(x) # strong functional dependency
fun.chisq.test(t(x)) # weak functional dependency
# Example 2. Normalized functional chi-square test
x <- matrix(c(8,0,8,0,8,0,2,0,2), 3)
fun.chisq.test(x, method="nfchisq") # strong functional dependency
fun.chisq.test(t(x), method="nfchisq") # weak functional dependency
# Example 3. Exact functional chi-square test
x <- matrix(c(4,0,4,0,4,0,1,0,1), 3)
fun.chisq.test(x, method="exact") # strong functional dependency
fun.chisq.test(t(x), method="exact") # weak functional dependency
# Example 4. Exact functional chi-square test on a real data set
# (Shen et al., 2002)
# x is a contingency table with row variable for p53 mutation and
# column variable for CIMP
x <- matrix(c(12,26,18,0,8,12), nrow=2, ncol=3, byrow=TRUE)
# Test the functional dependency: p53 mutation -> CIMP
fun.chisq.test(x, method="exact")
# Test the functional dependency CIMP -> p53 mutation
fun.chisq.test(t(x), method="exact")
Run the code above in your browser using DataLab