pcor.test(x, y, z, semi = FALSE, conf.level = 0.95, nrep = 1000,
method = c("pearson", "spearman"))
TRUE
the semi-partial correlation coefficient is computed and tested. In that case only y
is controlled for z
."cor"
or "rho"
corresponding to the method employed.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.pcor
set.seed(1444)
x <- 1:30
y <- 1:30+rnorm(30,0,2)
z1 <- runif(30,0,4)
z2 <- 30:1+rnorm(30,03)
pcor.test(x,y,z1)
pcor.test(x,y,list(z1,z2))
Run the code above in your browser using DataLab