11% File src / library / stats / man / fisher.test.Rd
22% Part of the R package , https : // www.R - project.org
3- % Copyright 1995 - 2022 R Core Team
3+ % Copyright 1995 - 2024 R Core Team
44% Distributed under GPL 2 or later
55
66\name {fisher.test }
@@ -24,17 +24,17 @@ fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
2424 \item {workspace }{an integer specifying the size of the workspace
2525 used in the network algorithm. In units of 4 bytes. Only used for
2626 non - simulated p - values larger than \eqn {2 \times 2 }{2 by 2 } tables.
27- Since \ R version 3.5.0 , this also increases the internal stack size
28- which allows larger problems to be solved , however sometimes needing
29- hours. In such cases , \code {simulate.p.values = TRUE } may be more
27+ This also increases the internal stack size
28+ which allows larger problems to be solved , sometimes needing
29+ hours. In such cases , \code {simulate.p.values = TRUE } may be more
3030 reasonable. }
3131 \item {hybrid }{a logical. Only used for larger than \eqn {2 \times 2 }{2 by 2 }
3232 tables , in which cases it indicates whether the exact probabilities
3333 (default ) or a hybrid approximation thereof should be computed. }
3434 \item {hybridPars }{a numeric vector of length 3 , by default describing
3535 \dQuote {Cochran ' s conditions} for the validity of the chi-squared
3636 approximation, see \s Quote{Details}.}
37- \i tem{control}{a list with named components for low level algorithm
37+ \i tem{control}{a list with named components for low- level algorithm
3838 control. At present the only one used is \c ode{"mult"}, a positive
3939 integer \e qn{\g e 2} with default 30 used only for larger than
4040 \e qn{2 \t imes 2}{2 by 2} tables. This says how many times as much
@@ -56,7 +56,7 @@ fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
5656 p-values by Monte Carlo simulation, in larger than \e qn{2 \t imes
5757 2}{2 by 2} tables.}
5858 \i tem{B}{an integer specifying the number of replicates used in the
59- Monte Carlo test.}
59+ Monte Carlo test when \c ode{simulate.p.value} is true .}
6060}
6161\v alue{
6262 A list with class \c ode{"htest"} containing the following components:
@@ -83,7 +83,7 @@ fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
8383 length. Incomplete cases are removed, vectors are coerced into
8484 factor objects, and the contingency table is computed from these.
8585
86- For \e qn{2 \t imes 2}{2 by 2} cases , p-values are obtained directly
86+ For \e qn{2 \t imes 2}{2 by 2} tables , p-values are obtained directly
8787 using the (central or non-central) hypergeometric
8888 distribution. Otherwise, computations are based on a C version of the
8989 FORTRAN subroutine \c ode{FEXACT} which implements the network developed by
@@ -105,7 +105,7 @@ fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
105105 alternative for a one-sided test is based on the odds ratio, so
106106 \c ode{alternative = " greater " } is a test of the odds ratio being bigger
107107 than \c ode{or}.
108-
108+ %
109109 Two-sided tests are based on the probabilities of the tables, and take
110110 as \s Quote{more extreme} all tables with probabilities less than or
111111 equal to that of the observed table, the p-value being the sum of such
@@ -120,16 +120,9 @@ fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
120120 cells have expected counts at least 5 (\c ode{= expect}), otherwise
121121 the exact calculation is used. A corresponding \c ode{if()} decision
122122 is made for all sub-tables considered.
123- %
124- Accidentally, \R has used \c ode{180} instead of \c ode{80} as
125- \c ode{percent}, i.e., \c ode{hybridPars[2]} in \R versions between
126- 3.0.0 and 3.4.1 (inclusive), i.e., the 2nd of the \c ode{hybridPars}
127- (all of which used to be hard-coded previous to \R 3.5.0).
128- Consequently, in these versions of \R , \c ode{hybrid=TRUE} never made a
129- difference.
130123
131124 In the \e qn{r \t imes c}{r x c} case with \e qn{r > 2} or \e qn{c > 2},
132- internal tables can get too large for the exact test in which case an
125+ internal tables can be too large for the exact test in which case an
133126 error is signalled. Apart from increasing \c ode{workspace}
134127 sufficiently, which then may lead to very long running times, using
135128 \c ode{simulate.p.value = TRUE} may then often be sufficient and hence
@@ -243,7 +236,7 @@ MP6 <- rbind(
243236 c(1,1,2,0,0,0,1),
244237 c(0,1,1,1,1,0,0))
245238fisher.test(MP6)
246- # Exactly the same p-value, as Cochran's conditions are never met:
247- fisher.test(MP6, hybrid= TRUE)
239+ # Exactly the same p-value, as Cochran's conditions are not met:
240+ fisher.test(MP6, hybrid = TRUE)
248241}
249242\k eyword{htest}
0 commit comments