找回密码
 注册
查看: 6332|回复: 0

R语言:fisher.test()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 20:45:33 | 显示全部楼层 |阅读模式
fisher.test(stats)
fisher.test()所属R语言包:stats

                                        Fisher's Exact Test for Count Data
                                         Fisher精确检验计数资料

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Performs Fisher's exact test for testing the null of independence of rows and columns in a contingency table with fixed marginals.
执行Fisher的精确检验测试的独立性与固定边际的应急表中的行和列的空。


用法----------Usage----------


fisher.test(x, y = NULL, workspace = 200000, hybrid = FALSE,
            control = list(), or = 1, alternative = "two.sided",
            conf.int = TRUE, conf.level = 0.95,
            simulate.p.value = FALSE, B = 2000)



参数----------Arguments----------

参数:x
either a two-dimensional contingency table in matrix form, or a factor object.
一个二维矩阵形式的应急表,或一个因素的对象。


参数:y
a factor object; ignored if x is a matrix.
一个因素对象;忽略x如果是一个矩阵。


参数:workspace
an integer specifying the size of the workspace used in the network algorithm.  In units of 4 bytes.  Only used for non-simulated p-values larger than 2 by 2 tables.
一个整数,指定网络算法中使用的工作区的大小。在4个字节为单位。仅用于非模拟p值比2 by 2表。


参数:hybrid
a logical. Only used for larger than 2 by 2 tables, in which cases it indicates whether the exact probabilities (default) or a hybrid approximation thereof should be computed. See "Details".
一个逻辑。仅用于大于2 by 2表,在此情况下,它指示是否应计算其确切的概率(默认)或混合逼近。见“详细资料”。


参数:control
a list with named components for low level algorithm control.  At present the only one used is "mult", a positive integer ≥ 2 with default 30 used only for larger than 2 by 2 tables.  This says how many times as much space should be allocated to paths as to keys: see file "fexact.c" in the sources of this package.
与为低水平算法控制命名的组件列表。目前使用的只有一个"mult"一个正整数≥ 230默认用于大于2 by 2表只。这说多少尽可能多的空间时,应分配给键的路径:看到文件fexact.c这个包的来源。


参数:or
the hypothesized odds ratio.  Only used in the 2 by 2 case.
假设的胜算比。只有在2 by 2的情况下使用。


参数:alternative
indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter.  Only used in the 2 by 2 case.
表示替代假说,必须是一个"two.sided","greater"或"less"。您可以指定只的首字母。只有在2 by 2的情况下使用。


参数:conf.int
logical indicating if a confidence interval for the odds ratio in a 2 by 2 table should be computed (and returned).
逻辑表示如果2 by 2表中的胜算比的置信区间应计算(返回)。


参数:conf.level
confidence level for the returned confidence interval.  Only used in the 2 by 2 case and if conf.int = TRUE.
返回的置信区间的置信水平。只用在2 by 2的情况下,如果conf.int = TRUE。


参数:simulate.p.value
a logical indicating whether to compute p-values by Monte Carlo simulation, in larger than 2 by 2 tables.
逻辑表示是否p值大于2 by 2表,通过蒙特卡罗模拟计算。


参数:B
an integer specifying the number of replicates used in the Monte Carlo test.
一个整数,指定在蒙特卡洛测试使用复制的数量。


Details

详情----------Details----------

If x is a matrix, it is taken as a two-dimensional contingency table, and hence its entries should be nonnegative integers. Otherwise, both x and y must be vectors of the same length.  Incomplete cases are removed, the vectors are coerced into factor objects, and the contingency table is computed from these.
如果x是一个矩阵,它被视为一个二维的应变表,因此其参赛作品必须是非负整数。否则,既x和y必须是相同长度的向量。不完整的情况下被删除,向量强迫因子的对象,并从这些计算的应变表。

For 2 by 2 cases, p-values are obtained directly using the (central or non-central) hypergeometric distribution. Otherwise, computations are based on a C version of the FORTRAN subroutine FEXACT which implements the network developed by Mehta and Patel (1986) and improved by Clarkson, Fan and Joe (1993). The FORTRAN code can be obtained from http://www.netlib.org/toms/643.  Note this fails (with an error message) when the entries of the table are too large.  (It transposes the table if necessary so it has no more rows than columns.  One constraint is that the product of the row marginals be less than 2^31 - 1.)
2 by 2情况下,p值获得直接使用(中央或中央)超几何分布。否则,计算的基础上的C版本的FORTRAN子程序FEXACT的,它实现了网络开发由梅塔和帕特尔(1986)和改进克拉克森,风扇和乔(1993)。 FORTRAN代码可以得到从http://www.netlib.org/toms/643。注意:此失败(错误消息)时,该表的条目太大。 (调换表,如果有必要,所以它没有更多的行比列。一个制约因素是该行的边际产品是比2^31 - 1。)

For 2 by 2 tables, the null of conditional independence is equivalent to the hypothesis that the odds ratio equals one.  "Exact" inference can be based on observing that in general, given all marginal totals fixed, the first element of the contingency table has a non-central hypergeometric distribution with non-centrality parameter given by the odds ratio (Fisher, 1935).  The alternative for a one-sided test is based on the odds ratio, so alternative = "greater" is a test of the odds ratio being bigger than or.
2 by 2表,有条件的独立的空等效的假设,胜算比等于一。 “精确”的推断可以根据观察,在一般情况下,所有固定的边际总计,应急表中的第一个元素的胜算比(费希尔,1935)非集中参数与非中央超几何分布。为一种片面的测试方法是基于胜算比,所以alternative = "greater"比or更大的胜算比是一个考验。

Two-sided tests are based on the probabilities of the tables, and take as "more extreme" all tables with probabilities less than or equal to that of the observed table, the p-value being the sum of such probabilities.
双面的测试是基于表的可能性,并采取更极端的所有表的概率小于或等于所观察到的表,p值是等概率的总和。

For larger than  2 by 2 tables and hybrid =     TRUE, asymptotic chi-squared probabilities are only used if the "Cochran conditions" are satisfied, that is if no cell has count zero, and more than 80% of the cells have counts at least 5: otherwise the exact calculation is used.
比2 by 2表和大hybrid =     TRUE,渐近卡方概率仅用于如果“科克伦条件”感到满意,那就是如果没有单元计数为零,超过80%单元计数至少5:否则,使用精确的计算。

Simulation is done conditional on the row and column marginals, and works only if the marginals are strictly positive.  (A C translation of the algorithm of Patefield (1981) is used.)
仿真完成对行和列的边际条件,只有当边际是严格正。 (交流的翻译算法Patefield(1981)被使用。)


值----------Value----------

A list with class "htest" containing the following components:
一类"htest"包含以下组件的列表:


参数:p.value
the p-value of the test.
p值的测试。


参数:conf.int
a confidence interval for the odds ratio. Only present in the 2 by 2 case and if argument conf.int = TRUE.
为胜算比的置信区间。只存在于2 by 2的情况下,如果参数conf.int = TRUE。


参数:estimate
an estimate of the odds ratio.  Note that the conditional Maximum Likelihood Estimate (MLE) rather than the unconditional MLE (the sample odds ratio) is used. Only present in the 2 by 2 case.
胜算比的估计。请注意,使用条件的极大似然估计(MLE),而不是无条件的MLE(样本胜算比)。仅目前在2 by 2情况。


参数:null.value
the odds ratio under the null, or. Only present in the 2 by 2 case.
空下的胜算比,or。仅目前在2 by 2情况。


参数:alternative
a character string describing the alternative hypothesis.
字符串描述替代假说。


参数:method
the character string "Fisher's Exact Test for Count Data".
字符串"Fisher's Exact Test for Count Data"。


参数:data.name
a character string giving the names of the data.
字符串提供的数据的名称。


参考文献----------References----------

Categorical data analysis. New York: Wiley. Pages 59–66.
Categorical data analysis. Second edition. New York: Wiley. Pages 91–101.
The logic of inductive inference. Journal of the Royal Statistical Society Series A 98, 39–54.
Confidence limits for a cross-product ratio. Australian Journal of Statistics 4, 41.
Statistical Methods for Research Workers.  Oliver & Boyd.
Algorithm 643. FEXACT: A Fortran subroutine for Fisher's exact test on unordered <code>r*c</code> contingency tables. ACM Transactions on Mathematical Software, 12, 154&ndash;161.
A Remark on Algorithm 643: FEXACT: An Algorithm for Performing Fisher's Exact Test in <code>r x c</code> Contingency Tables. ACM Transactions on Mathematical Software, 19, 484&ndash;488.
Algorithm AS159.  An efficient method of generating r x c tables with given row and column totals. Applied Statistics 30, 91&ndash;97.

参见----------See Also----------

chisq.test
chisq.test

fisher.exact in package exact2x2 for alternative interpretations of two-sided tests and confidence intervals for 2 by 2 tables.
fisher.exact包exact2x22 by 2表双面测试和置信区间的另类诠释。


举例----------Examples----------


## Agresti (1990, p. 61f; 2002, p. 91) Fisher's Tea Drinker[Agresti#(1990年,带够61F; 2002年,第91页)费舍尔的茶饮]
## A British woman claimed to be able to distinguish whether milk or[#一位英国妇女声称能够分辨牛奶或]
##  tea was added to the cup first.  To test, she was given 8 cups of[#茶第一杯。为了进行测试,给了她8杯]
##  tea, in four of which milk was added first.  The null hypothesis[#茶,牛奶加入其中四个第一。虚无假设]
##  is that there is no association between the true order of pouring[#是有没有真正的秩序之间的浇筑协会]
##  and the woman's guess, the alternative that there is a positive[#和女人的猜测,替代,是一个积极的]
##  association (that the odds ratio is greater than 1).[#协会(胜算比大于1)。]
TeaTasting <-
matrix(c(3, 1, 1, 3),
       nrow = 2,
       dimnames = list(Guess = c("Milk", "Tea"),
                       Truth = c("Milk", "Tea")))
fisher.test(TeaTasting, alternative = "greater")
## =&gt; p=0.2429, association could not be established[#=> P = 0.2429,协会不能成立]

## Fisher (1962, 1970), Criminal convictions of like-sex twins[#费舍尔(1962年,1970年),像同性双胞胎的刑事定罪]
Convictions <-
matrix(c(2, 10, 15, 3),
       nrow = 2,
       dimnames =
       list(c("Dizygotic", "Monozygotic"),
            c("Convicted", "Not convicted")))
Convictions
fisher.test(Convictions, alternative = "less")
fisher.test(Convictions, conf.int = FALSE)
fisher.test(Convictions, conf.level = 0.95)$conf.int
fisher.test(Convictions, conf.level = 0.99)$conf.int

## A r x c table  Agresti (2002, p. 57) Job Satisfaction[#一个RXC表的Agresti(2002年,第57页)工作满意度]
Job <- matrix(c(1,2,1,0, 3,3,6,1, 10,10,14,9, 6,7,12,11), 4, 4,
dimnames = list(income=c("< 15k", "15-25k", "25-40k", "> 40k"),
                satisfaction=c("VeryD", "LittleD", "ModerateS", "VeryS")))
fisher.test(Job)
fisher.test(Job, simulate.p.value=TRUE, B=1e5)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 05:39 , Processed in 0.022201 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表