## ----echo=FALSE, message=FALSE------------------------------------------------
library(olsrr)
library(ggplot2)
library(gridExtra)
library(nortest)
library(goftest)

## ----viftol-------------------------------------------------------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_vif_tol(model)

## ----cindex-------------------------------------------------------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_eigen_cindex(model)

## ----colldiag-----------------------------------------------------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_coll_diag(model)

## ----rfsplot, fig.width=10, fig.height=5, fig.align='center'------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_plot_resid_fit_spread(model)

## ----partcor------------------------------------------------------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_correlations(model)

## ----obspred, fig.width=5, fig.height=5, fig.align='center'-------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_plot_obs_fit(model)

## ----lackfit------------------------------------------------------------------
model <- lm(mpg ~ disp, data = mtcars)
ols_pure_error_anova(model)

## ----diagpanel, fig.width=10, fig.height=10, fig.align='center'---------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_plot_diagnostics(model)

## ----rvsrplot, fig.width=5, fig.height=5, fig.align='center'------------------
model <- lm(mpg ~ disp + hp + wt, data = mtcars)
ols_plot_resid_regressor(model, 'drat')

## ----avplot, fig.width=10, fig.height=10, fig.align='center'------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_plot_added_variable(model)

## ----cplusr, fig.width=10, fig.height=10, fig.align='center'------------------
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_plot_comp_plus_resid(model)

