# resid.squares

From HH v2.1-23
0th

Percentile

##### plot squared residuals in inches to match the y-dimension

plot squared residuals in inches to match the y-dimension

Keywords
models, regression
##### Usage
resid.squares(x, y, y.hat, resid.plot = "square", ...)
##### Arguments
x
x values
y
observed y values
y.hat
predicted y values
resid.plot
If "square", then plot the squared residuals. If TRUE (or anything else), then plot straight lines for the residuals.
...
Other graphics arguments.
##### Details

The goal is to get real squares on the screen or paper. The trick is to play games with the aspect ratio. We find the number of inches that each vertical residual occupies. We then find the number of x-units that corresponds to, and plot a rectangle with height=height in the y-data units and with width=the number of x-units that we just calculated.

##### References

Heiberger, Richard~M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0-387-40270-5.

regr1.plot

##### Aliases
• resid.squares
##### Examples
hardness <- read.table(hh("datasets/hardness.dat"), header=TRUE)
hardness.lin.lm  <- lm(hardness ~ density, data=hardness)

plot(hardness ~ density, data=hardness, xlim=c(22,73), ylim=c(0,3400))
abline(hardness.lin.lm)
resid.squares(hardness$density, hardness$hardness,
predict(hardness.lin.lm))

plot(hardness ~ density, data=hardness, xlim=c(22,73), ylim=c(0,3400))
abline(hardness.lin.lm)
resid.squares(hardness$density, hardness$hardness,
predict(hardness.lin.lm), resid.plot = "line")
Documentation reproduced from package HH, version 2.1-23, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.