1. Statistical Reference Guide
  2. Correlation and association

Correlation: Pearson, Spearman & Kendall in ExcelCorrelation analysis explores the association between two or more variables and makes inferences about the strength of the relationship.

Note: It is common to use the terms correlation and association interchangeably. Technically, association refers to any relationship between two variables, whereas correlation is often used to refer only to a linear relationship between two variables. The terms are used interchangeably in this guide, as is common in most statistics texts.

Scatter plot

A scatter plot shows the association between two variables. A scatter plot matrix shows all pairwise scatter plots for many variables.


correlation

If the variables tend to increase and decrease together, the association is positive. If one variable tends to increase as the other decreases, the association is negative. If there is no pattern, the association is zero.

When a straight line describes the relationship between the variables, the association is linear. When a constantly increasing or decreasing nonlinear function describes the relationship, the association is monotonic. Other relationships may be nonlinear or non-monotonic.

The type of relationship determines the statistical measures and tests of association that are appropriate.

If the association is a linear relationship, a bivariate normal density ellipse summarizes the correlation between variables. The narrower the ellipse, the greater the correlation between the variables. The wider and more round it is, the more the variables are uncorrelated. If the association is nonlinear, it is often worth trying to transform the data to make the relationship linear as there are more statistics for analyzing linear relationships and their interpretation is easier than nonlinear relationships.

An observation that appears detached from the bulk of observations may be an outlier requiring further investigation. An individual observation on each of the variables may be perfectly reasonable on its own but appear as an outlier when plotted on a scatter plot. Outliers can badly affect the product-moment correlation coefficient, whereas other correlation coefficients are more robust to them.

Creating a scatter plot or scatter plot matrix

Visualize the relationships between two or more variables.

  1. Select a cell in the dataset.
  2. On the Analyse-it ribbon tab, in the Statistical Analyses group, click Correlation, and then click Scatterplot or Scatterplot Matrix, and then click the plot type.
    The analysis task pane opens.
  3. If the model is bivariate, in the X and Y drop-down lists, select the variables.
  4. If the model is multivariate, in the Variables list, select the variables.
  5. Optional: To show stratification of the observations, select Vary point color/symbol, and then in the Group / Color / Symbol drop-down list, select a variable.
  6. Optional: To label the observations, select the Label observations check box.
  7. Click Calculate.

Covariance

Covariance is a measure of how much two variables change together. A covariance matrix measures the covariance between many pairs of variables.

When the variables tend to show similar behavior, the covariance is positive. That is when greater values of one variable mainly correspond with the greater values of the other variable, or lesser values of one variable correspond with lesser values of the other variable. When the variables tend to show opposite behavior, the covariance is negative. That is when the greater values of one variable mainly correspond to the lesser values of the other and vice-versa.

The magnitude of the covariance is not meaningful to interpret. However, the standardized version of the covariance, the correlation coefficient, indicates by its magnitude the strength of the relationship.

A covariance matrix measures the covariance between many variables. Because the covariance of a variable with itself is that variable's variance, the diagonal of the covariance matrix is simply the variance of each variable.

Correlation coefficient

A correlation coefficient measures the association between two variables. A correlation matrix measures the correlation between many pairs of variables.

The type of relationship between the variables determines the best measure of association:

  • When the association between the variables is linear, the product-moment correlation coefficient describes the strength of the linear relationship.

    The correlation coefficient ranges from -1 to +1. +1 indicates a perfect positive linear relationship, and -1 indicates a perfect negative linear relationship. Zero indicates the variables are uncorrelated and there is no linear relationship. Normally the correlation coefficient lies somewhere between these values.

  • When the association between the variables is not linear, a rank correlation coefficient describes the strength of association.

    Rank correlation coefficients range from -1 to +1. A positive rank correlation coefficient describes the extent to which as one variable increases the other variable also tends to increase, without requiring that increase to be linear. If one variable increases, as the other tends to decrease, the rank correlation coefficient is negative.

It is best to use a scatter plot to identify the type of association between the variables and then use an appropriate measure of association for the relationship. Do not be tempted just to look for the highest correlation coefficient.

A correlation matrix measures the correlation between many variables. It is equivalent to a covariance matrix of the standardized variables.

Color map

A color map highlights the sign and magnitude of coefficients in a patterned matrix.


color map

Red indicate negative values, blue indicates positive values. Intensity of the color represents the magnitude of the value, the darker more extreme.

Calculating a correlation matrix

Measure the correlation / association between 2 or more variables.

  1. Select a cell in the dataset.
  2. On the Analyse-it ribbon tab, in the Statistical Analyses group, click Correlation or Multivariate, and then click the statistics to show:
    Option Description
    Correlation Matrix Show the product-moment correlation coefficients.
    Rank Correlation Matrix Show the rank correlation coefficients.
    The analysis task pane opens.
  3. In the Variables list, select the variables.
  4. Optional: To highlight the coefficients depending on their sign and magnitude, select the Color maps check box.
  5. Optional: To show univariate descriptive statistics for each variable, select the Descriptives for each variable check box.
  6. Click Calculate.

Calculating a covariance matrix

Measure the covariance between 2 or more variables.

  1. Select a cell in the dataset.
  2. On the Analyse-it ribbon tab, in the Statistical Analyses group, click Multivariate, and then click Covariance Matrix.
    The analysis task pane opens.
  3. In the Variables list, select the variables.
  4. Click Calculate.

Inferences about association

Inferences about the strength of association between variables are made using a random bivariate sample of data drawn from the population of interest.

Correlation not Causation

Do not be fooled into thinking a significant correlation implies you to make statements about causation.

Correlation does not imply causation is a reminder that although a statistically significant correlation might exist between two variables, it does not imply that one causes the other.

There are many reasons why correlation does not imply causation: reverse causation where causation is actually in the opposite direction; bidirectional causation where a change in one variable causes a change in the other and vice-versa; a third unobserved variable that is the actual cause of the correlation; or simply a coincidence.

Correlation is a hint to investigate further, where possible using a controlled experiment. In some fields controlled experiments are impossible. Instead, cause and effect can be established only by observing the same thing in a wide variety of scenarios until all but the suspected cause can be ruled out. Even then the causal relationship can only be confirmed when you discover the underlying mechanism of the cause and effect.

Parameter estimate

A parameter estimate is either a point or interval estimate of the unknown population correlation coefficient.

A point estimate is a single value that is the best estimate of the true unknown population correlation coefficient; a confidence interval is a range of values and indicates the uncertainty of the estimate.

Estimators for correlation and association

Estimators for correlation/association and their properties and assumptions.

Estimator Purpose
Pearson r Estimate the Pearson rho correlation coefficient using the sample Pearson correlation coefficient r.

Use when a linear function best describes the relationship between the variables.

Susceptible to outliers. Assumes a bivariate normal distribution.

Spearman rs Estimate the Spearman rho rank correlation coefficient using the sample Spearman rs correlation coefficient.

Use when a monotonic function best describes the relationship between variables.

Kendall tau Estimate the Kendall tau rank correlation coefficient.

Use when a monotonic function best describes the relationship between the variables. Preferred instead of Spearman correlation because Kendall's tau is the difference between the probability that the two variables are in the same order, versus the probability that the two variables are in different orders.

Robust to outliers.

Estimating the correlation/association

Estimate the correlation/association between pairs of variables.

  1. Select a cell in the dataset.
  2. On the Analyse-it ribbon tab, in the Statistical Analyses group, click Correlation, and then the parameter estimator.
    The analysis task pane opens.
  3. If analyzing two variables:
    1. In the Model drop-down menu, select Bivariate.
    2. In the X drop-down list, select the first variable.
    3. In the Y drop-down list, select the second variable.
  4. If analyzing more than two variables:
    1. In the Model drop-down menu, select Multivariate.
    2. In the Variables list, select the variables.
  5. In the Confidence interval edit box, type the confidence level as a percentage, or type - to suppress the confidence interval, and then in the drop-down list, select the confidence bounds.
  6. In the Method drop-down list, select the interval estimator.
  7. Click Calculate.

Correlation/association hypothesis test

A hypothesis test formally tests if there is correlation/association between two variables in a population.

The hypotheses to test depends on the type of association:

  • For a product-moment correlation, the null hypothesis states that the population correlation coefficient is equal to a hypothesized value (usually 0 indicating no linear correlation), against the alternative hypothesis that it is not equal (or less than, or greater than) the hypothesized value.
  • For rank correlation methods, the hypotheses are restricted and more general. The null hypothesis states the variables are independent, against the alternative hypothesis that there is an association, such as a monotonic function.

When the test p-value is small, you can reject the null hypothesis and conclude that the population correlation coefficient is not equal to the hypothesized value, or for rank correlation that the variables are not independent. It is important to remember that a statistically significant test may not have any practical importance if the correlation coefficient is very small.

Pearson's and Kendall's tests are preferred as both have associated estimators of the population correlation coefficient (rho and tau respectively). Although the Spearman test is popular due to the ease of computation, the Spearman correlation coefficient is a measure of the linear association between the ranks of the variables and not the measure of association linked with the Spearman test.

Testing correlation/association

Test if the correlation between 2 variables is equal to a hypothesized value, or test for independence.

  1. Select a cell in the dataset.
  2. On the Analyse-it ribbon tab, in the Statistical Analyses group, click Correlation, and then the parameter estimator.
    The analysis task pane opens.
  3. If analyzing two variables:
    1. In the Model drop-down menu, select Bivariate.
    2. In the X drop-down list, select the first variable.
    3. In the Y drop-down list, select the second variable.
  4. If analyzing more than two variables:
    1. In the Model drop-down menu, select Multivariate.
    2. In the Variables list, select the variables.
  5. Select the Hypothesis test check box.
  6. In the Hypotheses drop-down list, select the null and alternative hypothesis.
  7. Optional: To compare the p-value against a predefined significance level, in the Significance level edit box, type the maximum probability of rejecting the null hypothesis when in fact it is true (typically 5% or 1%).
  8. Click Calculate.

Study design

Multivariate analysis study requirements and dataset layout.

Requirements

  • 2 or more quantitative variables.

Dataset layout

Use a a column for each variable (Height, Weight); each row has the values of the variables for a case (Subject).

Subject (optional) Height Weight
1 175 65
2 180 70
3 160 90
4 190 55
5 180 100
6 150 55
7 140 75
8 160 80
9 165 80
10 180 95

Statistical Reference Guide v6.20.0