Description Usage Arguments Details Value Examples
View source: R/z_fisher_test.R
z_fisher_test
performs test on Pearson's correlation using Fisher's Z
transform.
1 2 | z_fisher_test(x, y, rho0 = 0, alternative = "two.sided",
conf_level = 0.95)
|
x |
a numeric vector. |
y |
a numeric vector. |
rho0 |
Pearson's correlation under null hypothesis. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf_level |
confidence level of the interval |
It can be proved that \frac{1}{2}\ln≤ft(\frac{1 + r}{1- r} \right) has normal distribution with mean \frac{1}{2}\ln≤ft(\frac{1 + ρ}{1- ρ} \right) and variance σ^2 = \frac{1}{n - 3}.
z_fisher_test
return a list with the following components:
statistic of test
p-value
a character string specifying the alternative hypothesis
lower bound in the confidence interval
upper bound in the confidence interval
confidence level of the interval
1 2 3 4 5 6 7 8 | # x and y are not correlated
Sigma <- matrix(c(1, 0, 0, 1), ncol = 2)
m <- MASS::mvrnorm(500, mu = c(0, 1), Sigma = Sigma)
z_fisher_test(m[, 1], m[, 2])
# x and y are correlated
Sigma <- matrix(c(1, 0.85, 0.85, 1), ncol = 2)
m <- MASS::mvrnorm(500, mu = c(0, 1), Sigma = Sigma)
z_fisher_test(m[, 1], m[, 2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.