The R Project SVN R

Rev

Rev 61433 | Rev 65999 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61433 Rev 63475
Line 1... Line 1...
1
% File src/library/stats/man/termplot.Rd
1
% File src/library/stats/man/termplot.Rd
2
% Part of the R package, http://www.R-project.org
2
% Part of the R package, http://www.R-project.org
3
% Copyright 1995-2012 R Core Team
3
% Copyright 1995-2013 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\newcommand{\CRANpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
6
\newcommand{\CRANpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
7
 
7
 
8
\name{termplot}
8
\name{termplot}
Line 21... Line 21...
21
         col.se = "orange", lty.se = 2, lwd.se = 1,
21
         col.se = "orange", lty.se = 2, lwd.se = 1,
22
         col.res = "gray", cex = 1, pch = par("pch"),
22
         col.res = "gray", cex = 1, pch = par("pch"),
23
         col.smth = "darkred", lty.smth = 2, span.smth = 2/3,
23
         col.smth = "darkred", lty.smth = 2, span.smth = 2/3,
24
         ask = dev.interactive() && nb.fig < n.tms,
24
         ask = dev.interactive() && nb.fig < n.tms,
25
         use.factor.levels = TRUE, smooth = NULL, ylim = "common",
25
         use.factor.levels = TRUE, smooth = NULL, ylim = "common",
26
         plot = TRUE, \dots)
26
         plot = TRUE, transform.x = FALSE, \dots)
27
}
27
}
28
\arguments{
28
\arguments{
29
  \item{model}{fitted model object}
29
  \item{model}{fitted model object}
30
  \item{data}{data frame in which variables in \code{model} can be
30
  \item{data}{data frame in which variables in \code{model} can be
31
    found}
31
    found}
32
  \item{envir}{environment in which variables in \code{model} can be found}
32
  \item{envir}{environment in which variables in \code{model} can be found}
33
  \item{partial.resid}{logical; should partial residuals be plotted?}
33
  \item{partial.resid}{logical; should partial residuals be plotted?}
34
  \item{rug}{add \link{rug}plots (jittered 1-d histograms) to the axes?}
34
  \item{rug}{add \link{rug}plots (jittered 1-d histograms) to the axes?}
35
  \item{terms}{which terms to plot (default \code{NULL} means all
35
  \item{terms}{which terms to plot (default \code{NULL} means all
36
    terms); a \code{\link{character}} vector, passed to
36
    terms); a vector passed to
37
    \code{\link{predict}(.., term = "terms", terms = *)}.}
37
    \code{\link{predict}(.., term = "terms", terms = *)}.}
38
  \item{se}{plot pointwise standard errors?}
38
  \item{se}{plot pointwise standard errors?}
39
  \item{xlabs}{vector of labels for the x axes}
39
  \item{xlabs}{vector of labels for the x axes}
40
  \item{ylabs}{vector of labels for the y axes}
40
  \item{ylabs}{vector of labels for the y axes}
41
  \item{main}{logical, or vector of main titles;  if \code{TRUE}, the
41
  \item{main}{logical, or vector of main titles;  if \code{TRUE}, the
Line 59... Line 59...
59
   \item{ylim}{an optional range for the y axis, or \code{"common"} when
59
   \item{ylim}{an optional range for the y axis, or \code{"common"} when
60
     a range sufficient for all the plot will be computed, or
60
     a range sufficient for all the plot will be computed, or
61
     \code{"free"} when limits are computed for each plot.}
61
     \code{"free"} when limits are computed for each plot.}
62
   \item{plot}{if set to \code{FALSE} plots are not produced: instead a
62
   \item{plot}{if set to \code{FALSE} plots are not produced: instead a
63
     list is returned containing the data that would have been plotted.}
63
     list is returned containing the data that would have been plotted.}
-
 
64
   \item{transform.x}{logical vector; if an element (recycled as necessary)
-
 
65
     is \code{TRUE}, partial residuals for the corresponding term are 
-
 
66
     plotted against transformed values. 
-
 
67
     The model response is then a straight line, allowing a
-
 
68
     ready comparison against the data or against the curve
-
 
69
     obtained from \code{smooth-panel.smooth}.}
64
   \item{\dots}{other graphical parameters.}
70
   \item{\dots}{other graphical parameters.}
65
}
71
}
66
\details{
72
\details{
67
  The \code{model} object must have a \code{predict} method that accepts
73
  The \code{model} object must have a \code{predict} method that accepts
68
  \code{type = terms}, e.g., \code{\link{glm}} in the \pkg{stats} package,
74
  \code{type = terms}, e.g., \code{\link{glm}} in the \pkg{stats} package,
Line 110... Line 116...
110
termplot(model, main = paste("termplot( ", deparse(model$call)," ...)"))
116
termplot(model, main = paste("termplot( ", deparse(model$call)," ...)"))
111
termplot(model, rug = TRUE)
117
termplot(model, rug = TRUE)
112
termplot(model, partial.resid = TRUE, se = TRUE, main = TRUE)
118
termplot(model, partial.resid = TRUE, se = TRUE, main = TRUE)
113
termplot(model, partial.resid = TRUE, smooth = panel.smooth, span.smth = 1/4)
119
termplot(model, partial.resid = TRUE, smooth = panel.smooth, span.smth = 1/4)
114
if(!had.splines && rs) detach("package:splines")
120
if(!had.splines && rs) detach("package:splines")
-
 
121
 
-
 
122
if (require(MASS)) {
-
 
123
    hills.lm <- lm(log(time) ~ log(climb)+log(dist), data=hills)
-
 
124
    termplot(hills.lm, partial.resid = TRUE, smooth = panel.smooth, 
-
 
125
             terms = "log(dist)", main = "Original")
-
 
126
    termplot(hills.lm, transform.x = TRUE, partial.resid = TRUE, 
-
 
127
	     terms = "log(dist)", main = "Transformed",
-
 
128
	     smooth=panel.smooth)
-
 
129
}
115
}
130
}
116
\keyword{hplot}
131
\keyword{hplot}
117
\keyword{regression}
132
\keyword{regression}