Learn R Programming

psre (version 0.1.2)

rrPlot: 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"
)

Value

A cowplot object.

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab