cr_plots: Component+Residual Plots

View source: R/cr_plots.R

cr_plotsR Documentation

Component+Residual Plots

Description

Produces component+residual (partial residual) plots for linear models.

Usage

cr_plots(x, alpha = 0.4, span = 0.75)

Arguments

x

an object of type "lm".

alpha

numeric; degree of transparency for points (0 to 1, default=0.4)

span

numeric; the degree of smoothing for loess lines (default=0.75)

Details

This function is a modification of the crPlots function in the car package, using ggplot2 rather than base graphics.

Value

a ggplot2 graph

Note

The linear model can contain factors but not interactions. Plots are based on all predictors, but only the numeric variables are plotted. Each plot has a linear and loess fit line.

See Also

crPlot, crPlots

Examples

mtcars$am <- factor(mtcars$am)
fit <- lm(mpg ~ wt + am + disp + hp, mtcars)
cr_plots(fit)


Rkabacoff/qacReg documentation built on Aug. 1, 2022, 11:11 p.m.