Data Management and Visualization: Gapminder Assignment 4 - A Summary.
Let’s devote this post to summarize what we have done so far and what our conclusions are. As you might know by now we are working with the Gapminder data set and my research questions read:
Is there an association between life expectancy (response variable) and employment rate (explanatory variable)?
Does the variable CO2 emissions play a role in affecting this relationship?
My hypothesis: I believed that both variables will affect the life expectancy in a positive direction, meaning keeping either of the variable fixed and increasing the other would lead to and increase in life expectancy.
After removing rows with incomplete observations we can visualize all three variables in a histogram.
The variable with CO2 emissions is extremely right skewed and has very high variability. This is addressed by creating a new variable called log_co2 where we have taken the natural logarithm of the original variable. The employment rate variable has a std. around 20 and is a bit right skewed while the life expectancy variable is a bit left skewed with a std. of around 10. The histogram of log_co2 can be viewed below.
The variability is now much lower with a std. of 5.
In order to examine the first research question we plot employment rate and life expectancy in a scatter plot.
Unfortunately this does not make us any wiser. There actually seems to be no correlation at all between the variables. This can also be confirmed by grouping the employment rate according to the categories below and the use a bar plot for visualization.
if (employrate le 51.2) then employ_level = 1; else if (employrate le 58.8) then employ_level = 2; else if (employrate le 65) then employ_level = 3; else employ_level = 4;
We might want to color code the CO2 emission and try to get some more insight.
As it is quite hard to discern any patterns in this we opt for another strategy where we creates levels of CO2 emissions:
if (10 <= log_co2 <= 18.5)then co2_level = 1; else if (18.5 < log_co2 <= 21.2) then co2_level = 2; else if (log_co2 > 21.2) then co2_level = 3;
The interesting thing here is that as a stand alone variable employment rate does not seem to give information about life expectancy but together with CO2 there actually seems to be some interesting relations as can be seen below:
So to answer the research questions there seems to be three different associations (two negative and one positive) between employment rate and life expectancy one for each category of CO2 emission. That means that my initial hypothesis only seems to hold true for countries with a high level of CO2 emissions and for countries not falling into this category the relationship is the opposite.











