Finding confounding variables
We're going to explore the topic of confounding a little more. Returning to our UN demographic data, we'll again be looking to make a comparison between countries in Asia and Europe. Here we're interested in comparing Asian and European life expectancy, using a DataFrame provided as euasdata
. For each Country
, you have three figures available: their GDP per capita in USD (GDP_per_cap
), their female life expectancy (Life_exp
) and their unemployment rate (Unemployment
). Which of these factors may be confounding? You'll need to create some plots in order to explore these issues. pandas
and plotnine
have been loaded into the workspace as pd
and p9
.
This exercise is part of the course
Performing Experiments in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Life expectancy density plot
plotLifeVCont = ____ + p9.aes(x=____, fill=____) +____(alpha=0.5)