| pcor.test | R Documentation |
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.
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.
cor, cov2cor, eigen,
cor.test
# load the R code "pcor.test"
source("pcor.R")
# data
y.data <- data.frame(
hl=c(7,15,19,15,21,22,57,15,20,18),
disp=c(0.000,0.964,0.000,0.000,0.921,0.000,0.000,1.006,0.000,1.011),
deg=c(9,2,3,4,1,3,1,3,6,1),
BC=c(1.78e-02,1.05e-06,1.37e-05,7.18e-03,0.00e+00,0.00e+00,0.00e+00,4.48e-03,2.10e-06,0.00e+00)
)
# partial correlation between "hl" and "disp" given "deg" and "BC"
pcor.test(y.data$hl,y.data$disp,y.data[,c("deg","BC")])
pcor.test(y.data[,1],y.data[,2],y.data[,c(3:4)])
pcor.test(y.data[,1],y.data[,2],y.data[,-c(1:2)])