1. Learn
  2. /
  3. Courses
  4. /
  5. Handling Missing Data with Imputations in R

Exercise

Linear regression imputation

Sometimes, you can use domain knowledge, previous research or simply your common sense to describe the relations between the variables in your data. In such cases, model-based imputation is a great solution, as it allows you to impute each variable according to a statistical model that you can specify yourself, taking into account any assumptions you might have about how the variables impact each other.

For continuous variables, a popular model choice is linear regression. It doesn't restrict you to linear relations though! You can always include a square or a logarithm of a variable in the predictors. In this exercise, you will work with the simputation package to run a single linear regression imputation on the tao data and analyze the results. Let's give it a try!

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Load the simputation package.
  • Use impute_lm() to perform a linear regression imputation of air_temp and humidity, while using year, latitude and sea_surface_temp as predictors and assign the result to tao_imp.