1. Exploring coefficients across models
In the last chapter you learned about the list column workflow to build multiple models, and you learned about the three functions from the broom package that allow you to explore these models. In this chapter, you will combine these techniques to learn more about your models and your data.
2. 77 models
Recall that the gap_models data frame contains information about each country from 1960 to 2011, and that the features are nested as a tibble for each country. Using these tibbles, you built simple linear models predicting life_expectancy by year for each country. In this video and exercises that follow, you will learn how to use the coefficients of these models to gain new insights into the gapminder data.
3. Regression coefficients
So let's briefly review how to interpret the coefficients for a simple linear regression model.
Remember that this involves calculating two coefficient terms that relate the dependent variable y to the independent variable x.
4. Regression coefficients
For our models, the y variable is life expectancy as it relates to the year, our x variable.
The coefficient of the intercept tells us the expected life expectancy at year zero. This isn't meaningful for our data so we won't focus on this term.
Instead, we are interested in the estimate of the year coefficient which, for a simple linear model, directly corresponds to the slope.
Using the tidy() function on the first model we learn that with each passing year the average life expectancy of the population of this country increases by approximately 0.63 years.
This approach can provide you with information about the growth or lack of growth in life expectancy over time for the countries that you are modeling.
5. Coefficients of multiple models
You can generate these coefficients by mapping the tidy() function for each of your models and then simplifying the new data frame by using the unnest() function.
This results in a tibble containing the estimate for each coefficient of every country model.
6. Let's practice!
Now let's explore these values to see what you can learn from this data.