reg.line

0th

Percentile

Plot Regression Line

Plots a regression line on a scatterplot; the line is plotted between the minimum and maximum x-values.

Keywords
aplot
Usage
reg.line(mod, col=palette()[2], lwd=2, lty=1,...)
Arguments
mod
a model, such as produced by lm, that responds to the coefficients function by returning a 2-element vector, whose elements are interpreted respectively as the intercept and slope of a regresison line.
col
color for points and lines; the default is the second entry in the current color palette (see palette and par).
lwd
line width; default is 2 (see par).
lty
line type; default is 1, a solid line (see par).
...
optional arguments to be passed to the lines plotting function.
Details

In contrast to abline, this function plots only over the range of the observed x-values. The x-values are extracted from mod as the second column of the model matrix.

Value

  • NULL. This function is used for its side effect: adding a line to the plot.

See Also

abline, lines

Aliases
  • reg.line
Examples
plot(repwt ~ weight, pch=c(1,2)[sex], data=Davis)
reg.line(lm(repwt~weight, subset=sex=="M", data=Davis))
reg.line(lm(repwt~weight, subset=sex=="F", data=Davis), lty=2)
Documentation reproduced from package car, version 1.2-15, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.