FisherZ | R Documentation |
Convert a correlation to a z score or z to r using the Fisher transformation or find the confidence intervals for a specified correlation.
FisherZ(rho)
FisherZInv(z)
CorCI(rho, n, conf.level = 0.95, alternative = c("two.sided", "less", "greater"))
rho |
the Pearson's correlation coefficient |
z |
a Fisher z transformed value |
n |
sample size used for calculating the confidence intervals |
alternative |
is a character string, one of |
conf.level |
confidence level for the returned confidence interval, restricted to lie between zero and one. |
The sampling distribution of Pearson's r is not normally distributed. Fisher developed a transformation now called "Fisher's z-transformation" that converts Pearson's r to the normally distributed variable z. The formula for the transformation is:
z_r = tanh^{-1}(r) = \frac{1}{2}log\left ( \frac{1+r}{1-r}\right )
z value corresponding to r (in FisherZ)
r corresponding to z (in FisherZInv)
rho, lower and upper confidence intervals (CorCI)
William Revelle <revelle@northwestern.edu>,
slight modifications Andri Signorell <andri@signorell.net> based on R-Core code
cor.test
cors <- seq(-.9, .9, .1)
zs <- FisherZ(cors)
rs <- FisherZInv(zs)
round(zs, 2)
n <- 30
r <- seq(0, .9, .1)
rc <- t(sapply(r, CorCI, n=n))
t <- r * sqrt(n-2) / sqrt(1-r^2)
p <- (1 - pt(t, n-2)) / 2
r.rc <- data.frame(r=r, z=FisherZ(r), lower=rc[,2], upper=rc[,3], t=t, p=p)
round(r.rc,2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.