Description Usage Arguments Details Value Note Author(s) References See Also Examples
~~ A concise (1-5 lines) description of what the function does. ~~
1 |
tab |
~~Describe |
~~ If necessary, more details than the description above ~~
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
~~further notes~~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help
, ~~~
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.