cor.test(stats)
cor.test()所属R语言包:stats
Test for Association/Correlation Between Paired Samples
协会/配对样本之间的相关性试验
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Test for association between paired samples, using one of Pearson's product moment correlation coefficient, Kendall's tau or Spearman's rho.
测试配对样本之间的关联,使用皮尔森积矩相关系数,肯德尔的tau或Spearman的rho的之一。
用法----------Usage----------
cor.test(x, ...)
## Default S3 method:[默认方法]
cor.test(x, y,
alternative = c("two.sided", "less", "greater"),
method = c("pearson", "kendall", "spearman"),
exact = NULL, conf.level = 0.95, continuity = FALSE, ...)
## S3 method for class 'formula'[类formula的方法]
cor.test(formula, data, subset, na.action, ...)
参数----------Arguments----------
参数:x, y
numeric vectors of data values. x and y must have the same length.
数字数据值的向量。 x和y必须有相同的长度。
参数:alternative
indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. "greater" corresponds to positive association, "less" to negative association.
表示替代假说,必须是一个"two.sided","greater"或"less"。您可以指定只的首字母。 "greater"对应正相关,"less"负相关。
参数:method
a character string indicating which correlation coefficient is to be used for the test. One of "pearson", "kendall", or "spearman", can be abbreviated.
一个字符串,指示哪些相关系数是用于测试。一个"pearson","kendall"或"spearman",可以被缩写。
参数:exact
a logical indicating whether an exact p-value should be computed. Used for Kendall's tau and Spearman's rho. See "Details" for the meaning of NULL (the default).
逻辑是否应计算一个确切的p值。用于Kendall的tau和斯皮尔曼rho的。 NULL(默认)的含义,请参阅“详细资料”。
参数:conf.level
confidence level for the returned confidence interval. Currently only used for the Pearson product moment correlation coefficient if there are at least 4 complete pairs of observations.
返回的置信区间的置信水平。目前只用于皮尔逊积差相关系数,如果有至少4对完整的观测。
参数:continuity
logical: if true, a continuity correction is used for Kendall's tau and Spearman's rho when not computed exactly.
逻辑:如果属实,连续性校正用于Kendall的tau“斯皮尔曼rho时没有精确计算。
参数:formula
a formula of the form ~ u + v, where each of u and v are numeric variables giving the data values for one sample. The samples must be of the same length.
~ u + v形式的公式,其中每个u和v提供一个样本的数据值的数值变量。样品必须是相同的长度。
参数:data
an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).
一个可选的矩阵或数据框(或类似:看到model.frame)包含公式formula的变量。默认情况下采取的变量从environment(formula)。
参数:subset
an optional vector specifying a subset of observations to be used.
一个可选的向量,指定要使用的意见的一个子集。
参数:na.action
a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").
一个函数,它表示数据时,包含NA的,应该发生什么。 getOption("na.action")默认。
参数:...
further arguments to be passed to or from methods.
进一步的参数被传递到或从方法。
Details
详情----------Details----------
The three methods each estimate the association between paired samples and compute a test of the value being zero. They use different measures of association, all in the range [-1, 1] with 0 indicating no association. These are sometimes referred to as tests of no correlation, but that term is often confined to the default method.
这三种方法每个估计配对样本和计算零值测试之间的关联。他们使用不同的措施,公司章程,所有范围内的[-1, 1]用0表示没有任何关联。这些有时被称为没有相关的测试,但这一术语往往局限于默认的方法。
If method is "pearson", the test statistic is based on Pearson's product moment correlation coefficient cor(x, y) and follows a t distribution with length(x)-2 degrees of freedom if the samples follow independent normal distributions. If there are at least 4 complete pairs of observation, an asymptotic confidence interval is given based on Fisher's Z transform.
method如果是"pearson",测试统计的基础上皮尔逊积矩相关系数cor(x, y)和length(x)-2自由度分布如下,如果样本遵循独立正态分布。如果有至少4个完整的观测对,渐近置信区间给出基于Fisher的Z变换。
If method is "kendall" or "spearman", Kendall's tau or Spearman's rho statistic is used to estimate a rank-based measure of association. These tests may be used if the data do not necessarily come from a bivariate normal distribution.
method如果是"kendall"或"spearman",肯德尔的tau或斯皮尔曼rho统计是用来估计的协会的排名为基础的措施。这些测试可以使用,如果数据并不一定从二元正态分布。
For Kendall's test, by default (if exact is NULL), an exact p-value is computed if there are less than 50 paired samples containing finite values and there are no ties. Otherwise, the test statistic is the estimate scaled to zero mean and unit variance, and is approximately normally distributed.
肯德尔的测试,在默认情况下(exact如果是NULL),一个确切的P-值计算,如果有小于50配对样本含有有限值,有没有关系。否则,检验统计量是缩小到零均值和单位方差的估计,约正态分布。
For Spearman's test, p-values are computed using algorithm AS 89 for n < 1290 and exact = TRUE, otherwise via the asymptotic t approximation. Note that these are "exact" for n < 10, and use an Edgeworth series approximation for larger sample sizes (the cutoff has been changed from the original paper).
斯皮尔曼的测试,p值计算使用AS 89,通过渐近n < 1290逼近算法exact = TRUE和t否则。请注意,这些都是精确n < 10,使用较大的样本量(截止已经从原来的纸改变)Edgeworth级数逼近。
值----------Value----------
A list with class "htest" containing the following components:
一类"htest"包含以下组件的列表:
参数:statistic
the value of the test statistic.
检验统计量的值。
参数:parameter
the degrees of freedom of the test statistic in the case that it follows a t distribution.
自由的检验统计量的情况下,它的分布如下度。
参数:p.value
the p-value of the test.
p值的测试。
参数:estimate
the estimated measure of association, with name "cor", "tau", or "rho" corresponding to the method employed.
该协会估计的措施,名字"cor","tau"或"rho"相应的方法。
参数:null.value
the value of the association measure under the null hypothesis, always 0.
虚无假设下的价值,该协会的措施,始终0。
参数:alternative
a character string describing the alternative hypothesis.
字符串描述替代假说。
参数:method
a character string indicating how the association was measured.
一个字符串,指示如何测量协会。
参数:data.name
a character string giving the names of the data.
字符串提供的数据的名称。
参数:conf.int
a confidence interval for the measure of association. Currently only given for Pearson's product moment correlation coefficient in case of at least 4 complete pairs of observations.
置信区间为协会的措施。目前仅皮尔逊积矩相关系数至少有4个完整的观测对。
参考文献----------References----------
Algorithm AS 89: The Upper Tail Probabilities of Spearman's <code>rho</code>. Applied Statistics, 24, 377–379.
Nonparametric Statistical Methods. New York: John Wiley & Sons. Pages 185–194 (Kendall and Spearman tests).
参见----------See Also----------
Kendall in package Kendall.
Kendall包Kendall。
pKendall and pSpearman in package SuppDists, spearman.test in package pspearman, which supply different (and often more accurate) approximations.
pKendall和pSpearman包SuppDists,spearman.test包pspearman,提供不同的(而且往往更准确)近似。
举例----------Examples----------
## Hollander & Wolfe (1973), p. 187f.[#霍兰德和沃尔夫(1973),P。 187f。]
## Assessment of tuna quality. We compare the Hunter L measure of[#金枪鱼质量评估。我们比较亨特L措施]
## lightness to the averages of consumer panel scores (recoded as[#轻盈的消费者面板分数的平均值(重新]
## integer values from 1 to 6 and averaged over 80 such values) in[#整数的值从1到6,平均超过80值)]
## 9 lots of canned tuna.[#9很多金枪鱼罐头。]
x <- c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
y <- c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8)
## The alternative hypothesis of interest is that the[#利益的另一种假设是,]
## Hunter L value is positively associated with the panel score.[#亨特L值呈正相关与面板得分。]
cor.test(x, y, method = "kendall", alternative = "greater")
## => p=0.05972[#=> P = 0.05972]
cor.test(x, y, method = "kendall", alternative = "greater",
exact = FALSE) # using large sample approximation[使用大样本近似]
## => p=0.04765[#=> P = 0.04765]
## Compare this to[#与此相比,]
cor.test(x, y, method = "spearm", alternative = "g")
cor.test(x, y, alternative = "g")
## Formula interface.[#公式接口。]
require(graphics)
pairs(USJudgeRatings)
cor.test(~ CONT + INTG, data = USJudgeRatings)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|