The R Project SVN R

Rev

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

Rev 59629 Rev 60976
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
         \dots)
26
         plot = TRUE, \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 \code{\link{character}} 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
42
    model's call is taken as main title, \code{NULL} or \code{FALSE} mean
42
    model's call is taken as main title, \code{NULL} or \code{FALSE} mean
Line 57... Line 57...
57
     residuals for non-factor terms}
57
     residuals for non-factor terms}
58
   \item{lty.smth, col.smth, span.smth}{Passed to \code{smooth}}
58
   \item{lty.smth, col.smth, span.smth}{Passed to \code{smooth}}
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
-
 
63
     list is returned containing the data that would have been plotted.}
62
   \item{\dots}{other graphical parameters.}
64
   \item{\dots}{other graphical parameters.}
63
}
65
}
64
\details{
66
\details{
65
  The model object must have a \code{predict} method that accepts
67
  The \code{model} object must have a \code{predict} method that accepts
66
  \code{type=terms}, e.g., \code{\link{glm}} in the \pkg{base} package,
68
  \code{type = terms}, e.g., \code{\link{glm}} in the \pkg{stats} package,
67
  \code{\link[survival]{coxph}} and \code{\link[survival]{survreg}} in
69
  \code{\link[survival]{coxph}} and \code{\link[survival]{survreg}} in
68
  the \CRANpkg{survival} package.
70
  the \CRANpkg{survival} package.
69
 
71
 
70
  For the \code{partial.resid=TRUE} option it must have a
72
  For the \code{partial.resid = TRUE} option \code{model} must have a
71
  \code{\link{residuals}} method that accepts \code{type="partial"},
73
  \code{\link{residuals}} method that accepts \code{type = "partial"},
72
  which \code{\link{lm}} and \code{\link{glm}} do.
74
  which \code{\link{lm}} and \code{\link{glm}} do.
73
 
75
 
74
  The \code{data} argument should rarely be needed, but in some cases
76
  The \code{data} argument should rarely be needed, but in some cases
75
  \code{termplot} may be unable to reconstruct the original data
77
  \code{termplot} may be unable to reconstruct the original data
76
  frame. Using \code{na.action=na.exclude} makes these problems less likely.
78
  frame. Using \code{na.action=na.exclude} makes these problems less likely.
77
 
79
 
78
  Nothing sensible happens for interaction terms, and they may cause errors.
80
  Nothing sensible happens for interaction terms, and they may cause errors.
-
 
81
  
-
 
82
  The \code{plot = FALSE} option is useful when some special action is needed,
-
 
83
  e.g. to overlay the results of two different models or to plot
-
 
84
  confidence bands.
-
 
85
}
-
 
86
\value{
-
 
87
  For \code{plot = FALSE}, a list with one element for each plot which
-
 
88
  would have been produced.  Each element of the list is a data frame
-
 
89
  with variables \code{x}, \code{y}, and optionally the pointwise
-
 
90
  standard errors \code{se}. For continuous predictors \code{x} will
-
 
91
  contain the ordered unique values and for a factor it will be a factor
-
 
92
  containing one instance of each level.  The list has attribute
-
 
93
  \code{"constant"} copied from the predicted terms object.
-
 
94
 
-
 
95
  Otherwise, the number of terms, invisibly.
79
}
96
}
80
\seealso{For (generalized) linear models, \code{\link{plot.lm}} and
97
\seealso{For (generalized) linear models, \code{\link{plot.lm}} and
81
  \code{\link{predict.glm}}.}
98
  \code{\link{predict.glm}}.}
82
\examples{
99
\examples{
83
require(graphics)
100
require(graphics)