pcor.test | R Documentation |
Tests for (semi-)partial association between paired samples while controlling for other variables, using one of Pearson's product moment correlation coefficient or Spearman's rho.
pcor.test(x, y, z, semi = FALSE, conf.level = 0.95, nrep = 1000,
method = c("pearson", "spearman"))
x |
a numeric vector. |
y |
a numeric vector. |
z |
a numeric vector, matrix, data frame or list giving the controlling variables. For matrices, variables must be placed in columns. |
semi |
logical. If |
conf.level |
confidence level for confidence interval.. |
nrep |
number of replicates for computation of the confidence interval of a Spearman's rank correlation coefficient (by bootstraping). |
method |
a character string indicating which correlation coefficient is to be used for the test. One of "pearson" or "spearman". |
If method
is "pearson"
and if there are at least 4+k complete series of observation (where k is the number of controlling variables), an asymptotic confidence interval of the correlation coefficient is given based on Fisher's Z transform.
If method
is "spearman"
, the p-value is computed through the AS89 algorithm if the number of complete series of observation is less than 10, otherwise via the asymptotic t approximation (in both cases the pspearman
function is used). A confidence interval of the correlation coefficient, computed by bootstraping, is given.
data.name |
a character string giving the name(s) of the data. |
alternative |
a character string describing the alternative hypothesis, always two-sided. |
method |
a character string indicating how the association was measured. |
conf.int |
a condidence interval for the measure of association. |
statistic |
the value of the test statistic. |
parameter |
the degrees of freedom of the test (only for a Pearson's correlation coefficient). |
p.value |
the p-value of the test. |
estimate |
the estimated measure of association, with name |
null.value |
he value of the association measure under the null hypothesis, always 0. |
Maxime HERVE <maxime.herve@univ-rennes1.fr>
pcor
set.seed(1444)
x <- 1:30
y <- 1:30+rnorm(30,0,2)
z1 <- runif(30,0,4)
z2 <- 30:1+rnorm(30,0,3)
pcor.test(x,y,z1)
pcor.test(x,y,list(z1,z2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.