# How to Perform a t-Test for Correlation

A Pearson correlation coefficient is used to quantify the linear association between two variables.

It always takes on a value between -1 and 1 where:

• -1 indicates a perfectly negative linear correlation.
• 0 indicates no linear correlation.
• 1 indicates a perfectly positive linear correlation.

To determine if a correlation coefficient is statistically significant you can perform a t-test, which involves calculating a t-score and a corresponding p-value.

The formula to calculate the t-score is:

t = r√(n-2) / (1-r2)

where:

• r: The correlation coefficient
• n: The sample size

The p-value is calculated as the corresponding two-sided p-value for the t-distribution with n-2 degrees of freedom.

The following example shows how to perform a t-test for a correlation coefficient.

### Example: Performing a t-Test for Correlation

Suppose we have the following dataset with two variables: Using some statistical software (Excel, R, Python, etc.) we can calculate the correlation coefficient between the two variables to be 0.707.

This is a highly positive correlation, but to determine if it’s statistically significant we need to calculate the corresponding t-score and p-value.

We can calculate the t-score as:

• t = r√(n-2) / (1-r2)
• t = .707√(10-2) / (1-.7072)
• t = 2.828

Using a T Score to P Value Calculator, we find that the corresponding p-value is 0.022. Since this p-value is less than .05, we would conclude that the correlation between these two variables is statistically significant.