# Fisher r to z Transformation: Formula and Examples

The Fisher r to z transformation converts a Pearson correlation coefficient into a value that is approximately normally distributed, which makes confidence intervals and significance tests possible. You apply it with $z = \operatorname{artanh}(r)$, build your interval or test in z units, then convert back to the correlation scale. This article shows the formula, a full worked example, and the software functions that do it for you.

## Quick Answer

- The transformation is the inverse hyperbolic tangent of r: $z = \operatorname{artanh}(r) = \tfrac{1}{2}\ln\!\left(\frac{1+r}{1-r}\right)$ [1].
- Its main purpose is variance stabilization: the variance of z is roughly constant across values of the population correlation $\rho$, while the variance of r shrinks as $|\rho|$ approaches 1 [1].
- The standard error of z depends only on sample size: $SE = 1/\sqrt{n-3}$.
- A 95% confidence interval is $z \pm 1.96 \cdot SE$, then both limits are back-transformed with $r = \tanh(z)$.
- To compare two independent correlations, transform both, divide the z difference by the standard error of the difference, and compare the result to a normal distribution.

## The Formula

The forward transformation is:

$$z = \operatorname{artanh}(r) = \frac{1}{2}\ln\!\left(\frac{1+r}{1-r}\right)$$

The back-transformation is:

$$r = \tanh(z) = \frac{e^{2z}-1}{e^{2z}+1}$$

Symbols explained:

| Symbol | Meaning |
|---|---|
| $r$ | Sample Pearson correlation coefficient, between -1 and 1 |
| $z$ | Transformed value, roughly normal with standard error $1/\sqrt{n-3}$ |
| $n$ | Number of paired observations used to compute r |
| $\ln$ | Natural logarithm |
| $\tanh$ | Hyperbolic tangent, the inverse of artanh |
| $e$ | Euler's number, about 2.71828 |

The standard error of z is:

$$SE_z = \frac{1}{\sqrt{n-3}}$$

Notice that $n-3$ appears, not $n-1$ or $n-2$. This is the standard form used for the Fisher transformation [1]. The transformation requires at least four paired observations, since $n-3$ must be positive.

## How to Calculate It Step by Step

1. Compute the Pearson correlation r from your paired data. You can do this with any standard formula or function, such as `CORREL` in Excel or `scipy.stats.pearsonr` in Python. If you want a refresher on what r means, see [R and R-Squared: What They Mean and How to Interpret Them](/blog/data-analysis/r-and-r-squared-interpretation).
2. Apply the forward transformation: $z = \tfrac{1}{2}\ln\!\left(\frac{1+r}{1-r}\right)$.
3. Compute the standard error: $SE = 1/\sqrt{n-3}$.
4. Choose your confidence level and find the critical value. For 95% confidence, the two-sided normal critical value is 1.96.
5. Build the interval in z units: $z \pm 1.96 \cdot SE$.
6. Back-transform both limits with $r = \tanh(z) = \frac{e^{2z}-1}{e^{2z}+1}$.
7. Report the interval on the correlation scale, since that is what readers interpret.

For comparing two independent correlations $r_1$ and $r_2$ from samples of size $n_1$ and $n_2$:

$$Z = \frac{z_1 - z_2}{\sqrt{\frac{1}{n_1-3} + \frac{1}{n_2-3}}}$$

Then compare $Z$ to a standard normal distribution. This is the standard test for the difference between two independent correlations [1].

## Worked Example

The dataset is a class quiz: 25 students each took two quizzes, quiz_x and quiz_y. Here are the first rows, and the full set has 25 pairs.

| student_id | quiz_x | quiz_y |
|---|---|---|
| 1 | 72 | 78 |
| 2 | 65 | 60 |
| 3 | 80 | 85 |
| 4 | 58 | 55 |
| 5 | 90 | 92 |
| ... | ... | ... |
| 25 | 71 | 69 |

Step 1. The sample correlation across all 25 pairs is $r = 0.9809$.

Step 2. Forward transformation:

$$z = \frac{1}{2}\ln\!\left(\frac{1+0.9809}{1-0.9809}\right) = 2.3196$$

Step 3. Standard error:

$$SE = \frac{1}{\sqrt{25-3}} = \frac{1}{\sqrt{22}} = 0.2132$$

Step 4. 95% confidence interval in z units:

$$z \pm 1.96 \cdot SE = 2.3196 \pm 1.9600 \cdot 0.2132 = [1.9018,\ 2.7375]$$

Step 5. Back-transform the lower limit:

$$r_{lo} = \frac{e^{2 \cdot 1.9018}-1}{e^{2 \cdot 1.9018}+1} = 0.9564$$

Step 6. Back-transform the upper limit:

$$r_{hi} = \frac{e^{2 \cdot 2.7375}-1}{e^{2 \cdot 2.7375}+1} = 0.9917$$

The 95% confidence interval for the population correlation is [0.9564, 0.9917].

Here is the same computation in Python:

```python
import math
from scipy import stats
r = 0.9809
n = 25
z = 0.5 * math.log((1 + r) / (1 - r))
se = 1 / math.sqrt(n - 3)
zcrit = stats.norm.ppf(0.975)
z_lo, z_hi = z - zcrit*se, z + zcrit*se
r_lo = (math.exp(2*z_lo) - 1) / (math.exp(2*z_lo) + 1)
r_hi = (math.exp(2*z_hi) - 1) / (math.exp(2*z_hi) + 1)
print(f"z = {z:.4f}")
print(f"SE = {se:.4f}")
print(f"95% CI in z = [{z_lo:.4f}, {z_hi:.4f}]")
print(f"95% CI in r = [{r_lo:.4f}, {r_hi:.4f}]")
```

Output:

```text
z = 2.3196
SE = 0.2132
95% CI in z = [1.9018, 2.7375]
95% CI in r = [0.9564, 0.9917]
```

## How to Interpret the Result

The interval [0.9564, 0.9917] is on the correlation scale, so you can read it directly. The two quizzes are very strongly positively related, and the data are consistent with a population correlation anywhere from about 0.96 to about 0.99.

The interval is narrow because the sample is fairly large and r is high. If you had computed a confidence interval on the raw r scale using the wrong standard error, you would get a distorted interval, because the sampling distribution of r is skewed when r is near 1 [1]. The transformation fixes that skew.

For a hypothesis test, check whether the interval contains the value you are testing against. If you test $H_0: \rho = 0.90$, that value sits below 0.9564, so you would reject it at the 5% level. The same logic applies to any null value.

When comparing two correlations, the sign of $Z$ tells you which correlation is larger. A large absolute $Z$ means the difference is unlikely to be due to sampling noise.

## Doing It in Software

Excel has built-in `FISHER` and `FISHERINV` functions for the forward and back-transformation, and the formula is also short to write by hand. If r is in cell A1 and n is in cell A2, the forward transform is `=ATANH(A1)` and the standard error is `=1/SQRT(A2-3)`. The back-transform is `=TANH(A3)` where A3 holds a z value. Excel's `ATANH` and `TANH` functions are the direct equivalents of the formulas above.

In R, the base functions are `atanh()` and `tanh()`. The DescTools package provides a `FisherZ` function that converts a correlation to z or z back to r, and it documents the same formula used here [2]. If you are new to R syntax, [R transform Function: Syntax and Examples](/blog/data-analysis/r-transform-function) covers the general pattern of applying functions to data.

In Python, use `math.atanh` and `math.tanh`, or `numpy.arctanh` and `numpy.tanh` for arrays. The `scipy.stats` module provides `norm.ppf` for critical values. The snippet in the worked example shows the full pipeline.

If you are working with a larger dataset and want to see how paired variables are typically organized, [Dataset Examples: Types of Data Sets With Real Samples](/blog/data-analysis/dataset-examples-types-of-data-sets) shows common layouts.

## Common Mistakes

- Using $n-1$ or $n-2$ in the standard error. The correct denominator is $n-3$, and using the wrong one makes the interval too narrow or too wide.
- Reporting the confidence interval in z units. Readers interpret correlations, not artanh values, so always back-transform both limits.
- Applying the transformation to a correlation of exactly 1 or -1. The formula divides by zero, so it is undefined at the boundary.
- Assuming the transformation fixes non-normality in the raw data. It stabilizes the variance of r under bivariate normality, and it does not repair outliers or nonlinearity [1].
- Comparing dependent correlations with the independent-samples formula. If the two correlations share a variable, the standard error of the difference is different and the simple formula does not apply.
- Forgetting that the back-transformed interval is not symmetric around r. The z interval is symmetric, but after transformation the r interval is asymmetric, which is expected.

## Limitations

The Fisher transformation is an approximation that assumes the two variables follow a bivariate normal distribution [1]. When that assumption fails badly, the nominal coverage of the confidence interval can be off, especially in small samples. The approximation also degrades when the true correlation is extremely close to 1 or -1, because the transformation stretches that region heavily.

The transformation applies to Pearson correlations. It is not designed for Spearman rank correlations, point-biserial correlations, or other coefficients with different sampling distributions. For those, use methods built for the specific coefficient. Also remember that a confidence interval describes uncertainty about the population correlation, not the strength of a causal relationship.

## Frequently Asked Questions

### What is the Fisher r to z transformation used for?

It is used to build confidence intervals for a correlation and to test whether two correlations differ. The raw sampling distribution of r is skewed when the correlation is far from zero, and the transformation produces a value whose distribution is closer to normal with a known standard error [1].

### Why is the standard error 1 over the square root of n minus 3?

The variance of the transformed value z is approximately $1/(n-3)$ under bivariate normality. The 3 comes from Fisher's refinement of the large-sample approximation, which matches the true variance of z better than $1/n$ in moderate samples. This is the standard form used in textbooks and software [1].

### Can I use the Fisher transformation for a Spearman correlation?

No, not directly. The transformation is derived for the Pearson correlation under bivariate normality. Spearman correlations have a different sampling distribution, so applying the Fisher formula gives intervals with incorrect coverage.

### How do I compare two correlations from different samples?

Transform each correlation to z, compute the standard error of the difference as the square root of $1/(n_1-3) + 1/(n_2-3)$, then divide the z difference by that standard error. Compare the result to a standard normal distribution [1].

### Does the transformation change the value of the correlation?

Yes, it changes the scale. A correlation of 0.9809 becomes 2.3196 in z units. The transformation is monotonic, so the ordering of values is preserved, but the numbers themselves are on a different scale. You convert back to r before reporting.

### What sample size do I need?

You need at least four paired observations, because $n-3$ must be positive. In practice, small samples produce wide intervals and the normal approximation is weaker, so treat results from very small samples with caution [1].

## References

1. [Fisher transformation - Wikipedia](https://en.wikipedia.org/wiki/Fisher_transformation)
2. [FisherZ function - RDocumentation](https://www.rdocumentation.org/packages/DescTools/versions/0.99.60/topics/FisherZ)

## Further Reading

- [NIST/SEMATECH e-Handbook of Statistical Methods](https://www.itl.nist.gov/div898/handbook/index.htm)
- [Wasserstein RL, Lazar NA (2016). The ASA Statement on p -Values: Context, Process, and Purpose. The American Statistician](https://doi.org/10.1080/00031305.2016.1154108)
- [Krzywinski M, Altman N (2013). Significance, P values and t-tests. Nature Methods](https://doi.org/10.1038/nmeth.2698)
- [OpenStax. Introductory Statistics 2e](https://openstax.org/details/books/introductory-statistics-2e)

## Related Articles

- [R transform Function: Syntax and Examples](/blog/data-analysis/r-transform-function)
- [Geometric Distribution: Formula and Examples](/blog/data-analysis/geometric-distribution-formula-examples)
- [R and R-Squared: What They Mean and How to Interpret Them](/blog/data-analysis/r-and-r-squared-interpretation)
- [Generalized Linear Models: Definition and Examples](/blog/data-analysis/generalized-linear-models-explained)
- [Negative Binomial Distribution: Formula and Examples](/blog/data-analysis/negative-binomial-distribution-formula-examples)
- [How to Calculate Transformation Efficiency: Formula, Examples, and Common Pitfalls](/knowledge/diagnostics/molecular/calculate-transformation-efficiency-formula-examples)
- [Variance Stabilizing Transformation: When and How](/blog/research-skills/variance-stabilizing-transformation-when-and-how)
- [Chi-Square Test of Independence vs. Fisher](/knowledge/bioinformatics/chi-square-test-of-independence-vs-fisher-s-exact-test-a-decision-framework-for-small-sample-sizes-i)