cor.test(x, y, alternative = "two.sided", method = "pearson")
x, y
|
numeric vectors of data values. x and y
must have the same length.
|
alternative
|
indicates the alternative hypothesis and must be
one of "two.sided", "greater" or "less". You
can specify just the initial letter.
|
method
|
a string indicating which correlation coefficient is
used for the test. Must be one of "pearson",
"kendall", or "spearman". Only the first character is
necessary.
|
cor.test tests the null that x and y are
uncorrelated.
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 method is "kendall" or "spearman", Kendall's
tau or Spearman's rho, respectively, are used to estimate the
correlation. These tests should be used if the data do not necessary
come from a bivariate normal distribution. In both cases, the
standardized estimate is used as the test statistic, and is
approximately normally distributed.
"htest" containing the following components:
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. |
estimate
|
the estimated correlation coefficient, with names
attribute "cor", "tau", or "rho", correspoding
to the method employed.
|
null.value
|
the value of the correlation coefficient under the
null hypothesis, hence 0.
|
alternative
| a character string describing the alternative hypothesis. |
method
| a string indicating how the correlation was estimated |
data.name
| a character string giving the names of the data. |