pcor.test R Documentation

Partial Correlation


Calculate the partial correlation coefficient of both of parametric ("Pearson") and non-parametric ("Spearman" and "Kendall") statistics.


pcor.test(x, y, z, use = c("mat","rec"), method = c("pearson","spearman","kendall"), na.rm = T)


x a numeric vector. Missing values are allowed.
y a numeric vector. Missing values are allowed.
z a numeric vector, matrix or data frame. Missing values are allowed.
use an optional character string giving a method for computing the partial correlation coefficients. This must be one of the strings "mat" (default) or "rec".
method a character string indicating which partial correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman", can be abbreviated.
na.rm logical. Should missing values be removed? Default is True


estimate gives the partial correlation coefficieint between x and y given z, p.value gives the p-value of the test, statistic gives the value of the test statistic, n gives the number of samples after deleting all the missing samples, gn gives the number of given variables, Method gives the correlation method used, and Use gives the computation method used.


Partial correlation is the correlation of two variables while controlling for a third or more other variables. There are two methods to compute the partial correlation coefficient in pcor.test. One is by using variance-covariance matrix ("mat") and the other recursive formula ("rec"). Both of "mat" and "rec" give the same result in case of na.rm = T. Otherwise, the estimate may be slightly different from each other due to the way dealing with the missing samples, if there are the missing samples.


Kim, S-H. and Yi, S. (2007) Understanding relationship between sequence and functional evolution in yeast proteins . Genetica, In press.

Kim, S-H. and Yi, S. (2006) Correlated asymmetry between sequence and functional divergence of duplicate proteins in Saccharomyces cerevisiae . Molecular Biology and Evolution, 23: 1068–1075.

Johnson, Richard A. and Dean W. Wichern (2002) Applied multivariate statistical analysis. Prentice Hall.

Whittaker, Joe (1990) Graphical models in applied multivariate statistics. John Wiley & Sons.

See Also

cor, cov2cor, eigen, cor.test


# load the R code "pcor.test"

# data
y.data <- data.frame(

# partial correlation between "hl" and "disp" given "deg" and "BC"


[R code pcor.test]