Programs

# What is Correlation in Statistics? Definition, Examples

## What Is Correlation in Statistics?

Correlation can be described as a statistical measure that quantifies the relationship between two entities. It enables us to understand the extent to which changes in one variable are related to the changes in the other variable. A small example to help you understand what is Correlation positively might include the height and weight of a person. Taller people tend to be much heavier than shorter people.Â

Correlation has been one of the most commonly used tools for describing relationships without making any statement about cause and effect. There are primarily three main types of Correlation. They are,

• Positive Correlation- When two variables move in the same direction, it indicates a positive correlation. This means that if one variable increases, the other will also increase.
• Negative Correlation – Contrary to positive Correlation, negative Correlation is when two variables move in opposite directions. This means that if one variable increases, the other will decrease.Â
• No Correlation – This occurs when there is no linear relationship between two variables, and they tend to behave differently.

## What is the Correlation Coefficient in R?

In R programing language, the correlation coefficient is denoted by the symbol ‘r’ and is calculated using the ‘cor()’ function. The syntax for the same is as follows,

cor(x, y, method = …)

Here, ‘x’ and ‘y’ refer to the numeric data frames that represent the two variables for which we want to calculate the Correlation.

‘method’ signifies an optional argument that specifies the type of method used to calculate the Correlation.Â

The correlation coefficient ranges from -1 to +1Â

• When it is closer to +1, it signifies that there is a positive relationship between the two variables.
• When it is closer to -1, it indicates a negative relationship between the two variables.
• A correlation coefficient of 0 means that there is no form of linear relationship between the two variables.

Check out ourÂ free coursesÂ to get an edge over the competition.

## Types of Correlation Coefficient

In statistics, we primarily deploy two main types of correlation coefficients to measure the strength of the relationship between two variables. They are, namely,

### Pearson’s Product Moment Correlation

Pearson’s Product Moment correlation, also known as the Bivariate Correlation, is a descriptive statistic that measures the strength and direction of the linear relationship between two continuous variables. It is denoted by the symbol, ‘r’ and is often used in situations where,

• Both variables are quantitative
• The variables normally distributed
• There are no outliers in the dataÂ
• There is a linear relationship

If the relationship is not linear, then other correlation coefficients, such as Spearman’s rank correlation and Kendall’s rank correlation, are deployed.Â

### Spearman’s Rank Correlation

Spearman’s rank correlation, also known as Spearman’s rho, is a non-parametric measure of the strength and direction of the relationship between two variables. Contrary to Pearson’s correlation coefficient, the former is used when the data is ordinal or when the relationship between two variables is not linear. It is particularly beneficial when dealing with data that may not meet the assumptions of normality or when dealing with ranked data. This is primarily because Spearman’s rank correlation utilises the rank of the values. The data is ranked from the smallest to largest initially, and then the correlation coefficient is calculated based on the designated ranks.

upGrad’s Python Programming Bootcamp can be an excellent way to decode these concepts as it takes your journey to the next level! Get trained by industry experts and unlock exciting opportunities in the world of technology!

LearnÂ data science coursesÂ online from the Worldâ€™s top Universities. Earn Executive PG Programs, Advanced Certificate Programs, or Masters Programs to fast-track your career.

## Calculate Correlation Using Excel

Mentioned below is a step-by-step guide to how you can calculate correlation coefficients using Excel.

### Â Determine your data sets

The first and foremost step before beginning with the calculation is to decide on the variables. In this example, we have taken two variables, namely x and y, with values,

x: (1,2,3,4) and y (2,3,4,5)Â

### Calculate the mean of the x and y variables

We then use the Average function to calculate the mean of the x and y variables. The function operates by adding the values of each variable together and then dividing them by the total number of values in the dataset. For example, to calculate the mean of the X variable, we add the value 1,2,3,4 and divide it by four since x has four possible values. Similarly, we perform the same operation for y with its respective values.

### Subtract the mean

In a new column, we now subtract the mean from each x-variable as well as the y-variable separately. The result generated will be called a and b, respectively.Â

### Multiply and find the sum

Following this, we multiply each a-value with its matching b-value, and the total result that is generated will act as the numerator of the correlation formula.

### Take the square root

In this step, we use the SQRT function to determine the square root of the number that is obtained in the above-mentioned step. This will act as the denominator of the formula.

### Divide

Finally, we divide the denominator by the numerator, and the end result will be the correlation coefficient between the two data sets.

If it returns a positive value, then it indicates a positive correlation; a negative value, on the other hand, signifies a negative correlation. If the value is close to zero, then it means that there is little to no correlation between the two variables.

## Read our popular Data Science Articles

 Data Science Career Path: A Comprehensive Career Guide Data Science Career Growth: The Future of Work is here Why is Data Science Important? 8 Ways Data Science Brings Value to the Business Relevance of Data Science for Managers The Ultimate Data Science Cheat Sheet Every Data Scientists Should Have Top 6 Reasons Why You Should Become a Data Scientist A Day in the Life of Data Scientist: What do they do? Myth Busted: Data Science doesnâ€™t need Coding Business Intelligence vs Data Science: What are the differences?

## Kendall Correlation

Kendall’s rank correlation coefficient, also referred to as Kendall’s tau, measures the strength and direction of the association between two variables. It is a non-parametric measure of Correlation that is commonly used when dealing with ordinal data or when the assumption of normality is not met. It is also considered to be one of the best alternatives to Spearman’s Correlation, especially when your sample size is small or has many tied ranks. To calculate Kendall’s tau, we use the below-mentioned formula,

Kendallâ€™s Tau = (C â€“ D / C + D)

Here, C refers to the number of concordant pairs, and D denotes the number of discordant pairs.

However, calculating Kendall’s tau manually can be quite time-consuming at times. Therefore, many statistical software packages such as R, Python and Excel provide built-in functions that can automatically compute Kendall’s tau efficiently. This helps to save up a lot of time and effort, especially when you are working with a large dataset.

## Explore our Popular Data Science Courses

 Executive Post Graduate Programme in Data Science from IIITB Professional Certificate Program in Data Science for Business Decision Making Master of Science in Data Science from University of Arizona Advanced Certificate Programme in Data Science from IIITB Professional Certificate Program in Data Science and Business Analytics from University of Maryland Data Science Courses

## Limitations of Correlation

Now that you have a detailed understanding of what is correlation coefficient let’s take a look at some of its limitations. Such include,

• Correlation does not imply causation. Just because two variables are correlated, we cannot infer that one causes the other. There could always be the chances of underlying factors or variables that can influence the relationship.Â
• Correlation can only measure the strength and direction of the association between two variables. This means that when it comes to capturing complex relationships where the direction of influence changes over time or is based on other conditions, Correlation cannot generate the desired results.
• Correlation can accurately measure only the linear relationship between two variables. This means that if a non-linear relationship is present, then Correlation might not accurately represent the strength of the association.

## Examples of CorrelationÂ

Listed below are a few correlation examples to help you better understand what positive and negative Correlations signify.

Positive correlation

Positive Correlation, as stated previously, is when one variable increases, then the other variable will also increase. A small example of the same includes,

When there is a rise in the temperature, then the sale of ice creams also increases.Â

Negative Correlation

A negative Correlation is when one variable increases, then the other variable decreases, and vice versa. For example,

People who spend long hours of time watching TV tend to score lesser marks on their exam papers.

No Correlation

No correlation is when there is no clear relationship between the two variables. This means that the changes in one variable do not correspond to the changes in the other variables. For example,

There may not be a consistent relationship between height and shoe size across a diverse group of people.

## Top Data Science Skills to Learn

 Top Data Science Skills to Learn 1 Data Analysis Course Inferential Statistics Courses 2 Hypothesis Testing Programs Logistic Regression Courses 3 Linear Regression Courses Linear Algebra for Analysis

## Conclusion

Despite diverse limitations, Correlation still remains one of the most valuable tools for exploring relationships between variables and gathering valuable insights into patterns and associations in data. In this article, we have explored what is correlation coefficient, its types, and some real-life correlation examples. With this, hopefully, you have been able to clear all your doubts and queries regarding this topic.Â

If you wish to know more or pursue a career in this field of Data Science, then do not forget to check out upGrad’s Graduate Certificate Programme in Data Science and AI. This 6.5 month’s course is specifically designed for engineers and IT professionals who wish to learn about all the intricacies of Data Science. It also comes alongside a plethora of benefits such as 24*7 student support, industry-partnered projects, and live training sessions for acing job interviews.Â

## How is the Pearson correlation coefficient calculated?

Pearson's correlation coefficient is a measure of the linear relationship between two variables. It assesses the strength and direction of the relationship. The Pearson correlation coefficient formula is, r = Î£((Xi - XÌ„) * (Yi - È²)) / âˆš(Î£(Xi - XÌ„)^2 * Î£(Yi - È²)^2).

## What is the significance of the correlation coefficient value?

The correlation coefficient value serves as a powerful tool in statistics to understand the relationship between two variables. It generates valuable information related to the degree and direction of the association, which in turn can be utilised to make well-informed decisions across various fields such as finance, economics and data analysis. For example, if the value is closer to +1, it indicates a positive correlation, and if the value is closer to -1, there is a negative correlation.

## Can you explain the concept of correlation coefficient?

The correlation coefficient r is a statistical measure that helps researchers understand the association between two variables and make predictions accordingly. It takes values between -1 and +1 and is used to quantify the strength and direction of the linear relationship between two numerical variables.

## Explore Free Courses

×
Get Free career counselling from upGrad experts!
Book a session with an industry professional today!
Get Free career counselling from upGrad experts!
Book a Session with an industry professional today!