 # Correlation Vs Regression

## Introduction

In statistics, the terms correlation and regression are widely used. They have different meanings. In this blog, we will learn about them and their differences. You know that data is the driving force in every organization. You should also be aware that the demand for data scientists and analysts are increasing day by day. Statistical modelling is a very important part of machine learning and data science.

You must master statistical concepts to make a career out of data science. One such topic of interest as far as data analysts are concerned is correlation and regression. They are wonderful tools to offer insights and predictions, which can be employed in real time situations. So let us delve into it further and understand the concepts. We will learn what is correlation, regression, correlation coefficient, their differences, real time examples and much more.

## What is Correlation?

Correlation as the term suggests is the relationship between two variables. When we have two variables and they are connected with each other, any change made to one variable will lead to the change in another variable directly or indirectly. This is known are correlation.

The relationship in terms of direction and strength is expressed by a correlation coefficient, which is a number between -1 and 1.

• Positive Linear correlation

The correlation coefficient 1 indicates there is a positive linear correlation between two variables x and y. When there is a change in x variable, there is similar change in the y variable in the same direction.

• Negative Linear correlation

The correlation coefficient -1 indicates there is a negative linear correlation between two variables x and y. When there is a change in x variable, there is a change in the y variable in the opposite direction.

• No Linear correlation

The correlation coefficient 0 indicates there is no linear correlation between two variables x and y. Here there is no relationship between x and y.

## Correlation Formula

As we know that correlation shows the relationship between two variables. The measure of correlation is shown by the correlation coefficient. Correlation formulas are used to compare two datasets.

Pearson Correlation Coefficient Formula

The relationship between two data sets is depicted using the Pearson Correlation Coefficient formula. The coefficient value ranges from -1 to 1. -1 is negative linear correlation, +1 is positive linear correlation and 0 is no linear correlation meaning there is no relationship between the data sets.

Real Life Examples of correlation

Height and weight – There is a positive linear correlation between height and weight of an individual. The taller you are, the heavier you are.

Exam scores and time wasted in Leisure activities – There is a negative linear correlation when the student spends more time in playing, watching TV etc., their exam grades are lower.

Exercise and Body Fat – The more you exercise, the more fat you burn. There is a negative correlation between more exercise and burning body fat.

Tea consumption and Intelligence – There is zero linear correlation between tea consumed and intelligence quotient.

Summer time and ice cream sales: As the temperature goes up, the sales of ice cream goes up too. This is a positive correlation example.

Clothing size: As you grow up, the clothing size also increases. This is again another example of positive linear correlation.

Marketing: The greater amount of time spent in marketing your business, you will attract more customers.

If one eats more, then the less hunger he will feel. This is an example of negative correlation.

Another example of negative correlation is the more one exercises, there will be lesser health problems.

## Correlation analysis

Correlation analysis recognizes and assesses the relationship between two variables x and y. Rapid hypothesis testing can be achieved by correlation analysis, which is mainly used by companies to further their investigation of the chosen variables, as there is surplus of data available. As we know that correlation analysis involves measuring the direction and strength between two variables namely x and y.

The strength of the relationship is measured with the correlation coefficient which varies from -1 to 1. -1 and 1 indicates a perfect association between the two variables. 0 indicates no association between the two variables. The negative and positive sign of the coefficient present the direction of the relationship between the two variables.

## Types of Correlation

There are four types of correlation. They are as follows:

• Pearson Correlation Coefficient
• Population Correlation Coefficient
• Sample Correlation Coefficient
• Linear Correlation Coefficient

## What is Regression?

Regression is nothing but how one variable affects another variable. It is more of a cause and effect concept. If there are two variables, regression is

how they affect each other.

## Correlation Vs Regression

Let us understand the basic differences between correlation and regression.

 S.No Correlation Regression 1 Correlation shows the relationship between two variables. Regression shows the cause and effect relationship between two variables. 2 The two variables, x and y can be interchanged The two variables x and y cannot be interchanged 3 A single point represents the data A single line presents the data 4 The variables have a singular movement in any direction The variables have a cause and effect pattern either in same direction or opposite direction. 5 Prediction and optimization are not possible Prediction and optimization are possible

### Real Life Examples of Regression

Healthcare: Regression analysis can be used in healthcare to marginalize the critically ill patients and provide them tailor-made health plan and improve their quality of living. In this manner, there will be better health for patients which will incur low hospital costs.

Business: Regression can be used by organizations to analyse and understand their data and apply it to come up with better decision-making techniques.

Advertising: Regression analysis can be applied to amount of money spent on advertising and as a result the revenue incurred. There is a causal effect relationship.

Education: A classic example of linear regression is the number of marks a student obtains depends on the number of hours spent in studying for the exam.

Weight Reduction: An example of multiple linear regression is to predict the number of kilos of weight lost depends on the age, weight, height and exercise time of an individual.

#### Regression analysis

Being a data scientist, you should be proficient in regression analysis. It is mainly used in predictive modelling in data analytics. Regression analysis is to predict a dependent variable based on another independent variable.

There are many regression analyses available.

1. Linear regression
2. Logistic regression
3. Polynomial regression
4. Stepwise regression
5. Ridge regression
6. Lasso regression

The most commonly used forms of regression analysis are linear regression and logistic regression. Regression analysis can be used to make choice between two alternatives. They can also be used to predict important business trends to mainly predict the future sales of a particular product.

#### Scatter Diagram

This diagram shows the values of the two variables and the manner in which these two variables relate to each other. Along the horizontal axis, you have the values of the variable x and the vertical axis gives the values of the variable y.

In regression analysis, one variable is the independent variable and the other variable is the dependent variable. The independent variable x is said to have an influence on the dependent variable y. Here in regression, there is a cause and effect relationship between the two variables.

In correlation analysis, there is a symmetry between two variables x and y. There is no influence of one variable over the other. There is no cause and effect relationship as in regression.

## Correlation or Regression – Which One to Use When

We know that correlation analysis tells us about the strength and direction of two variables. We use correlation when we need to understand the direction of the relationship immediately. We use regression when we need to find out the influence of one variable over the other. To mainly determine the strength and direction of relationship, then correlation is the best bet. If you what to predict a trend, build a model or an equation, then regression is the right choice.

## Conclusion

Thus in this blog we have learned about the key differences between correlation and regression. We have also seen real life examples of both of them. As far as data science and machine learning are concerned, statistical modelling plays a key role where there is analysis of data, finding the relationship between variables and predicting the outcome of events. Correlation and regression analysis plays a vital role be it in business, healthcare, marketing, sales etc.

Also correlation and regression is employed in ecommerce, real estate, education etc. Learning statistical concepts like correlation and regression has become an important prerequisite for machine learning in order to select, evaluate and predict models. Topics in machine learning revolve around statistics.

You should have a grip over the fundamentals of statistics along with machine learning to solve the real time problems prevailing now.