rrPlot: Residual-Residual Plot

View source: R/effective_functions.r

rrPlotR Documentation

Residual-Residual Plot

Description

Produces a linear scatterplot array with marginal histograms. The plots have OLS regression lines and a 45-degree line.

Usage

rrPlot(
  formula,
  xlabels = NULL,
  ylab = NULL,
  data,
  return = c("grid", "grobs"),
  ptsize = 1,
  ptshape = 1,
  ptcol = "gray65"
)

Arguments

formula

Formula giving the variables to be plotted.

xlabels

Vector of character strings giving the labs of variables to be used in place of the variable names.

ylab

Character string giving y-variable label to be used instead of variable name.

data

A data frame that holds the variables to be plotted.

return

A string identify what to return. If ‘grid’, then a cowplot object is returned with all plots printed. If ‘grobs’ then a list with all of the individual ggplots/grobs is returned.

ptsize

Size of points.

ptshape

Shape of points.

ptcol

Color of points.

Value

A cowplot object.

Examples

data(wvs)
library(MASS)
lmod <- lm(secpay ~ gini_disp + democrat + log(pop), data=wvs)
e1_m <- rlm(secpay ~ gini_disp + democrat + log(pop), 
                  data=wvs, method="M")$residuals
e1_mm <- rlm(secpay ~ gini_disp + democrat + log(pop), 
                   data=wvs, method="MM")$residuals
e1dat <- data.frame(OLS = lmod$residuals, 
                    M = e1_m, 
                    MM = e1_mm)
rrPlot(OLS ~ M + MM, data=e1dat)

psre documentation built on Aug. 8, 2022, 5:05 p.m.

Related to rrPlot in psre...