Correlation Explained

Without definition lets see some real life examples of correlation to understand it in a more better way :
Positive Correlation (both increase or decrease together):

  • Ice cream sales and temperature: As the weather gets hotter (one variable increases), people tend to buy more ice cream (the other variable increases).
  • Amount of studying and exam grades: The more time you spend studying (one variable increases), the higher your exam grades are likely to be (the other variable increases).
  • Plant height and sunlight exposure: Plants that receive more sunlight (one variable increases) tend to grow taller (the other variable increases).

Negative Correlation (one increases while the other decreases):

  • Study time and amount of TV watched: The more time you spend studying (one variable increases), the less time you likely spend watching TV (the other variable decreases).
  • Depth underwater and water pressure: As you dive deeper underwater (one variable increases), the water pressure around you increases (the other variable decreases).
  • Age and eyesight: In general, as people get older (one variable increases), their eyesight tends to weaken (the other variable decreases).

Important to Remember:

  • Correlation doesn’t mean causation. Just because two things change together doesn’t mean one causes the other. In the ice cream example, hot weather might be the reason for both increased ice cream sales and more people at the beach.
  • Correlation looks for a linear relationship. Imagine a straight line. If two things move up or down together along this line, they have a correlation.

Now lets see this simple dataset :slight_smile:

Now lets create a correlation heatmap :

In this heatmap, the things being compared are height, weight, and gender. Each row and column of the heatmap represents one of these things. For example, the top row and leftmost column are both labeled “Height_in_inches”. This square shows the correlation between a person’s height and their height. Since height is perfectly correlated with itself, this square is colored dark red, which means there is a very strong positive correlation.

The other squares show the correlation between different things. For example, the square labeled “Weight_in_pound” in the row labeled “Height_in_inches” shows the correlation between a person’s height and their weight. The color in this square is a shade of orange, which means there is a moderate positive correlation. This means that taller people tend to also weigh more, but not perfectly.

The square labeled “Gender_encoded” in the row labeled “Height_in_inches” shows the correlation between a person’s height and their gender. The color in this square is light blue, which means there is a weak negative correlation. This means that there might be a very slight tendency for boys to be taller than girls on average, but it’s not a very strong relationship.

Here are some other things to keep in mind about correlation heatmaps:

  • Colors: Generally, red squares show positive correlations, blue squares show negative correlations, and white or gray squares show no correlation. The deeper the shade of red or blue, the stronger the correlation.

  • Scale: The scale on the right side of the heatmap shows the range of correlation values, from -1 (perfect negative correlation) to 1 (perfect positive correlation), with 0 in the middle (no correlation).
    The heatmap you sent shows the correlation between height, weight, and gender. Here’s a breakdown of the relationships:

  • Height and Weight: There’s a moderate positive correlation (orange square). This means taller people tend to weigh more, but it’s not a perfect relationship. There can be short people who weigh a lot and tall people who are thin.

  • Height and Gender: There’s a weak negative correlation (light blue square). This means there might be a very slight tendency for boys to be taller than girls on average, but it’s not very strong. There are many girls who are taller than boys and vice versa.

Steps and prompts to do correlation in julius:

Step 1: The name of my dataset is Height_wight_dataset.xlsx. First I have asked asked julius the following :

Julius : The dataset contains the following columns:

Given these variables, the two most appropriate for correlation analysis would be Height_in_inchies and Weight_in_pound. Correlation analysis between these two variables can help us understand if there’s a linear relationship between an individual’s height and weight, which is a common hypothesis in physiological studies.

Would you like to proceed with the correlation analysis between height and weight?

Step 2: Doing Pearson correlation coefficient between height and weight
Step 3: Compares the mean heights between genders
Step 4: Correlation between height and gender
Step 5: Give julius an instruction to make a heatmap of correlation matrix and show it

My entire steps are given here :

Hope you get a basic idea how correlation works!


Great and easily relatable sample and explanation, thank you! :star:

1 Like

Awesome, thanks for explaining correlation. Looks like Correlation matrix heatmap was generated with Julius. It would be great for the readers if you could include steps and prompts on how to do correlation in Julius :slight_smile:

Welcome and thank you for reading.

1 Like

Hello,Yes I have added. Thank you for reading.

1 Like