yyHatPlot: Plot y and yHat on the same scale w/reference line

Description Usage Arguments Details Value Examples

View source: R/expandFunctions.R

Description

Plots y and yHat on the same scale as a scatterplot with a 1:1 reference line in red. This is useful for visually comparing actual data y with estimates yHat, determining outliers, etc.

Usage

1
yyHatPlot(y, yHat, ...)

Arguments

y

Vector or matrix coercible to vector. Typically will be the quantity to be predicted.

yHat

Vector or matrix coercible to vector, same length as y. Typically will be the prediction.

...

Optional additional graph parameters.

Details

Normally only makes sense with vectors, column matrices, or row matrices.

Value

Returns invisibly - only used for graphic side effects.

Examples

1
2
3
4
5
6
7
8
set.seed(1)
nObs <- 80
X <- distMat(nObs,2)
A <- cbind(c(1,-1))
Y <- X %*% A + rnorm(nObs) # Response data
lmObj <- lm(Y ~ X)
Yhat <- predict(lmObj) # Estimated response
yyHatPlot(Y,Yhat)

Example output



expandFunctions documentation built on May 2, 2019, 9:15 a.m.