Exercise

Comparing and choosing the best adjusted R-squared

During the analysis of imputed DataFrames on a linear model, the adjusted R-squared(\(adj.R^2\)) score that explains the best fit model.

In this exercise, you will compare the \(adj.R^2\) scores of the linear models (for each of the imputed datasets) you created earlier, namely lm_mean, lm_KNN and lm_MICErespectively.

You will first neatly print (by creating a DataFrame) their attributes rsquared_adj and finally choose the model with maximum \(adj.R^2\).

The above models have already been loaded for you as lm_mean, lm_KNN and lm_MICE.

Instructions 1/2

undefined XP
  • 1
    • Use the .rsquared_adj attribute on each of the models \(-\) lm_mean, lm_KNN and lm_MICE to create rsquared_df.
  • 2
    • Use the max() function to get the best R-squared from rsquared_df. The key=rsquared_df.get gets the respective score.