confIntFisherTrafo {biostatUZH} | R Documentation |
Compute a confidence interval for a correlation coefficient r using the variance-stabilizing transformation
z = \tanh^{-1}(r) = 0.5 \log((1 + r) / (1 - r)),
known as Fisher's z-transformation. By means of this transformation, r is approximately normally distributed with variance (n-3)^{-1} independent of the true correlation ρ, enabling construction of a Wald-type confidence interval. Back-transformation yields a confidence interval for the correlation coefficient. An advantage of this approach is that the limits of the confidence interval are contained in (-1, 1).
confIntFisherTrafo(var1, var2, pp = c(0.025, 0.975), meth = "spearman", type = "t")
var1 |
Vector containing first variable. |
var2 |
Vector containing first variable. |
pp |
Vector in R^2 that contains α / 2 and 1 - α/2, where alpha is the confidence level of the confidence interval. |
meth |
Correlation coefficient to be used: |
type |
Quantile to be used: |
Yields a list with entries:
estimate |
Value of correlation coefficient. |
ci |
Computed confidence interval. |
p.value |
p-value for a test on ρ = 0 based on the transformation. |
n |
Number of observations. |
p2 |
p-value based on the |
Kaspar Rufibach
kaspar.rufibach@gmail.com
n <- 40 x <- runif(n) y <- 2 * x + 0.5 * rnorm(n) plot(x, y) confIntFisherTrafo(x, y, pp = c(0.025, 0.975), meth = "spearman", type = "t")