pcor.test: Tests for (semi-)partial association/correlation between...

View source: R/pcor.test.R

pcor.testR Documentation

Tests for (semi-)partial association/correlation between paired samples

Description

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.

Usage

pcor.test(x, y, z, semi = FALSE, conf.level = 0.95, nrep = 1000,
  method = c("pearson", "spearman"))

Arguments

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 TRUE the semi-partial correlation coefficient is computed and tested. In that case only y is controlled for z.

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".

Details

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.

Value

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 "cor" or "rho" corresponding to the method employed.

null.value

he value of the association measure under the null hypothesis, always 0.

Author(s)

Maxime HERVE <maxime.herve@univ-rennes1.fr>

See Also

pcor

Examples

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))

RVAideMemoire documentation built on Nov. 6, 2023, 5:07 p.m.