Rationale

While doing the model selection and analysis for our STDS AT2 group project, I found this package is very useful and provides lots of convenient and comprehensive functions to help us measure the models. Especially while I am reading the module 1 regression.nb.html, the VIF function is not clear to me. Therefore, I prefer to find a package that can simplify this. This article is a summary for functions available in car package which can help us for a detail model analysis.

library(car)
library(skimr)
library(tidyverse)

Functions

Thank for the R in Action by Robert I. Kabacoff, I can have a detail implementation of some functions in the package. I have listed some functions below that may be helpful when you try to analysis your model and do some plots.

Function Purpose
vif() Variance Inflation Factors
Anova() Anova Tables for Various Statistical Models
qqPlot() Quantile-Comparison Plots
crPlot() Component+Residual (Partial Residual) Plots
outlierTest() Bonferroni Outlier Test

The link: https://cran.r-project.org/web/packages/car/index.html can have more functions and details about the package.

data  <- mtcars
model <- lm(log(mpg) ~ cyl + disp + gear+carb, data=data)

qqPlot

This function provides a more accurate method to measure the normality assumption than just using the base package (Kabacoff, 2015).

qqPlot(model,labels = row.names(data),id.method = "identify",
       simulate= TRUE, main='QQ PLOT')

## Chrysler Imperial  Pontiac Firebird 
##                17                25

vif()

One good method/statistic to identify and exam multicollinearity is Variance Inflation Factor – VIF. For a general rule, any can be a potential multicollinearity problem (Kabacoff, 2015).

vif(model)
##      cyl     disp     gear     carb 
## 7.628603 5.882001 2.875314 2.889333
sqrt(vif(model)) >2
##   cyl  disp  gear  carb 
##  TRUE  TRUE FALSE FALSE

crPlot

This function can provide plots for partial residual plots which can be used to estimate model for the relationship between response and predictors. This could help our team to identify the models’ performance during the model selection. It is good to include for future analysis.

crPlots(model)

Reference

Kabacoff, R. (2015). R in Action, Second Edition: Data analysis and graphics with R - R in Action, Second Edition. https://learning.oreilly.com/library/view/r-in-action/9781617291388/kindle_split_000.html