Learn R Programming

fastR2 (version 1.2.4)

SSplot: Sum of Squares Plots

Description

This function creates plots showing the "consumption" of residual sum of squares resulting from adding predictors to a model.

Usage

SSplot(
  model1,
  model2,
  n = 1,
  col1 = "gray50",
  size1 = 0.6,
  col2 = "navy",
  size2 = 1,
  col3 = "red",
  size3 = 1,
  ...,
  env = parent.frame()
)

Arguments

model1

a linear model

model2

a linear model, often using rand().

n

an integer specifying how many times to regenerate model2.

col1, col2, col3

Colors for the line segments in the plot

size1, size2, size3

Sizes of the line segments in the plot

...

additional arguments (currently ignored)

env

an environment in which to evaluate the models.

Examples

Run this code
  
SSplot(
  lm(strength ~ limestone + water, data = Concrete),
  lm(strength ~ limestone + rand(7), data = Concrete),
  n = 50) 
if (FALSE) {
SSplot(
  lm(strength ~ water + limestone, data = Concrete),
  lm(strength ~ water + rand(7), data = Concrete),
  n = 1000) 
}

Run the code above in your browser using DataLab