Description Usage Arguments Details Value See Also Examples
Compute a bootstrap test to determine whether zero order correlation is equal to partial or semi-partial correlation.
1 2 |
x |
a numeric vector. |
y |
a numeric vector. |
z |
a numeric vector (data.frame, matrix, etc.) |
semi |
logical. If |
k |
the number of bootstrap samples taken (default is 1000). |
method |
a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman" can be abbreviated. |
test |
character string denoting the null hypothesis to be tested. Can be one of the three:
|
Uses the bias-corrected and accelerated (BCa) bootstrap method to test if the difference ρ.xy - ρ.xy.z is equal to, above, or below zero where ρ.xy is the zero order correlation between variables x and y, and ρ.xy.z is the (semi) partial correlation between the respective variables after partialing out variables represented by z.
If the bootstrap distribution of
ρ.xy - ρ.xy.z is strictly above or below zero, then
the p-value provided is the most extreme value that can be determined
by the test. In the case of highly correlated variables, the
covariance matrix may be singular which will lead to k_eff
being
less than k
(as ρ.xy - ρ.xy.z would not be computed).
acceleration |
the acceleration used for the BCa method. |
alpha |
the proportion of the bootstrapped distribution below zero. |
bias |
the bias used for the BCa method. |
call |
shows the function call. |
difference |
calculated from the data. Same as |
distribution |
the estimated distribution of the difference as determined through bootstrapping. |
k_eff |
the number of successful bootstrap samples. Less than or equal
to |
method |
the method of correlation used. |
p.value |
significance level of the test. |
p.xy |
Zero order correlation between |
p.xy.z |
(semi) partial correlation between |
semi |
logical. If |
test |
shows the type of test performed. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | require(graphics)
require(MASS)
# data
set.seed(1111)
mu <- rep(0,4)
Sigma <- matrix(.2, nrow=4, ncol=4) + diag(4)*.8
data <- mvrnorm(n=100, mu=mu, Sigma=Sigma)
# p.(1,2) = p.(1,2)|(3,4) test
test <- pzcor(data[,1], data[,2], data[,c(3,4)], k = 1000, semi = FALSE,
test = 'eq')
hist(test$distribution)
test
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.