fcatTest: Ham kiem dinh ti le bien dinh tinh

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/fcatTest.R

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

1

Arguments

tab

~~Describe tab here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1

Description of 'comp1'

comp2

Description of 'comp2'

...

Note

~~further notes~~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(tab) {
    min1<-if (min(tab)==Inf) NA else min(outer(margin.table(tab,1), margin.table(tab,2), "*")/margin.table(tab))
    st <- if(!is.matrix(tab) || is.na(min1) || nrow(tab) < 2 || ncol(tab) < 2)
         NULL else
         (if (min1<5)
         try(fisher.test(tab,simulate.p.value=TRUE),silent=T) else
         try(chisq.test(tab, correct=FALSE)))
    if (length(st)==1) st<-NULL   
    f1<-if(is.null(st)) list(P=1, stat=0, df=0, testname='No Test', statname='No Test',
         latexstat='\chi^{2}_{df}', plotmathstat='chi[df]^2') else
         (if (min1<5) list(P=st$p.value, stat=1,
         df=1, testname='Fisher', statname='Fisher',
         latexstat='\chi^{2}_{df}', plotmathstat='chi[df]^2') else
         list(P=st$p.value, stat=st$statistic,
         df=st$parameter,
         testname='Pearson', statname='Chi-square',
         latexstat='\chi^{2}_{df}', plotmathstat='chi[df]^2'))
    return(f1)
  }

gvdovandzung/thongke documentation built on May 23, 2020, 12:35 a.m.