File: regLine.Rd

package info (click to toggle)
car 3.1-5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496 kB
  • sloc: makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
\name{regLine}
\alias{regLine}

\title{Plot Regression Line}
\description{
  Plots a regression line on a scatterplot; the line is plotted 
  between the minimum and maximum x-values.
}
\usage{
regLine(mod, col=carPalette()[2], lwd=2, lty=1,...)
}

\arguments{
  \item{mod}{a model, such as produced by \code{lm},
    that responds to the \code{coef} function
    by returning a 2-element vector, whose elements are
    interpreted respectively as the
    intercept and slope of a regresison line.}
  \item{col}{color for points and lines; the default is the \emph{second} entry
    in the current \pkg{car} palette (see \code{\link{carPalette}}
    and \code{\link{par}}).}
  \item{lwd}{line width; default is \code{2} (see \code{\link{par}}).}
  \item{lty}{line type; default is \code{1}, a solid line (see \code{\link{par}}).}
  \item{\dots}{optional arguments to be passed to the
    \code{lines} plotting function.}
}
\details{
  In contrast to \code{abline}, this function plots only over
  the range of the observed x-values. The x-values are extracted from
  \code{mod} as the second column of the model matrix. 
}
\value{
  \code{NULL}. This function is used for its side effect: adding
  a line to the plot.
}

\author{John Fox \email{jfox@mcmaster.ca}}


\seealso{\code{\link{abline}}, \code{\link{lines}}}

\examples{
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)
}

\keyword{aplot}