Application for model selection

Ivana
15/01/20

Shiny application

This application is only a demo on a known dataset mtcars, it helps the modeller to:

  • Choose which variable to model
  • Find the best combination of dependent variables
  • Visualise the fit and the error of the model through two graphs (fitted vs. predicted and fitted vs. residuals)

This app shortens the process of model selection by skipping;

  • Fitting linear models on various variable combinations
  • Calculating R-squared and the corresponding p-value

Example

If we use lm model with milles per gallon (mpg) as the dependent variable and weight (wt) as independent variable we get R squared of 75% and the following graphs:

plot of chunk plots_mpgwt

Example continued

If we add number of cylinders as well, our R squared jumps to 83% and the predicted vs. fitted graph shows that slope is closer to 1:

plot of chunk plots_mpgwtcyl

Conclusion

Additionally by simply clicking variables and making a combination of variables as you see fit you can find out:

  • R-squared of that linear model variable combination
  • p-value of the overall model
  • Check if the residuals are independent
  • Check how fitted values correspond to the actual values

See for yourself at: https://izma-ltt.shinyapps.io/DDPW4/