Session Ready
Exercise

Mapping many models

The gap_nested dataframe available in your workspace contains the gapminder dataset nested by country.

You will use this data to build a linear model for each country to predict life expectancy using the year feature.

Note: The term feature is synonymous with the terms variable or predictor. It refers to an attribute of your data that can be used to build a machine learning model.

Instructions
100 XP
  • Build a linear model for each country predicting life_expectancy using the year feature. Use the lm() function for this and save this new dataframe containing models as gap_models.
  • Extract the first model from this dataframe and save this as algeria_model.
  • View the information about the model using summary().