regLine | R Documentation |
Plots a regression line on a scatterplot; the line is plotted between the minimum and maximum x-values.
regLine(mod, col=carPalette()[2], lwd=2, lty=1,...)
mod |
a model, such as produced by |
col |
color for points and lines; the default is the second entry
in the current car palette (see |
lwd |
line width; default is |
lty |
line type; default is |
... |
optional arguments to be passed to the
|
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.
NULL
. This function is used for its side effect: adding
a line to the plot.
John Fox jfox@mcmaster.ca
abline
, lines
plot(repwt ~ weight, pch=c(1,2)[sex], data=Davis)
regLine(lm(repwt~weight, subset=sex=="M", data=Davis))
regLine(lm(repwt~weight, subset=sex=="F", data=Davis), lty=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.