The R Project SVN R

Rev

Rev 61160 | Rev 67599 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/stats/man/lag.plot.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2007 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
27497 ripley 6
\name{lag.plot}
56186 murdoch 7
\alias{lag.plot}
27497 ripley 8
\title{Time Series Lag Plots}
9
\description{
10
  Plot time series against lagged versions of themselves.
42961 ripley 11
  Helps visualizing \sQuote{auto-dependence} even when auto-correlations
61433 ripley 12
  vanish.
27497 ripley 13
}
14
\usage{
15
lag.plot(x, lags = 1, layout = NULL, set.lags = 1:lags,
16
         main = NULL, asp = 1,
30915 ripley 17
         diag = TRUE, diag.col = "gray", type = "p", oma = NULL,
44243 ripley 18
         ask = NULL, do.lines = (n <= 150), labels = do.lines,
19
         \dots)
27497 ripley 20
}
21
\arguments{
22
  \item{x}{time-series (univariate or multivariate)}
23
  \item{lags}{number of lag plots desired, see arg \code{set.lags}.}
24
  \item{layout}{the layout of multiple plots, basically the \code{mfrow}
25
    \code{\link{par}()} argument.  The default uses about a square
26
    layout (see \code{\link{n2mfrow}} such that all plots are on one page.}
38356 ripley 27
  \item{set.lags}{vector of positive integers allowing specification of
28
    the set of lags used; defaults to \code{1:lags}.}
27497 ripley 29
  \item{main}{character with a main header title to be done on the top
30
    of each page.}
31
  \item{asp}{Aspect ratio to be fixed, see \code{\link{plot.default}}.}
32
  \item{diag}{logical indicating if the x=y diagonal should be drawn.}
33
  \item{diag.col}{color to be used for the diagonal \code{if(diag)}.}
34
  \item{type}{plot type to be used, but see \code{\link{plot.ts}} about
35
    its restricted meaning.}
36
  \item{oma}{outer margins, see \code{\link{par}}.}
38338 ripley 37
  \item{ask}{logical or \code{NULL}; if true, the user is asked to
38
    confirm before a new page is started.}
27497 ripley 39
  \item{do.lines}{logical indicating if lines should be drawn.}
40
  \item{labels}{logical indicating if labels should be used.}
38356 ripley 41
  \item{\dots}{Further arguments to \code{\link{plot.ts}}.  Several
42
    graphical parameters are set in this function and so cannot be
43
    changed: these include \code{xlab}, \code{ylab}, \code{mgp},
44
    \code{col.lab} and \code{font.lab}: this also applies to the
45
    arguments \code{xy.labels} and \code{xy.lines}.}
27497 ripley 46
}
38338 ripley 47
\details{
48
  If just one plot is produced, this is a conventional plot.  If more
49
  than one plot is to be produced, \code{par(mfrow)} and several other
50
  graphics parameters will be set, so it is not (easily) possible to mix
51
  such lag plots with other plots on the same page.
52
 
53
  If \code{ask = NULL}, \code{par(ask = TRUE)} will be called if more than
38356 ripley 54
  one page of plots is to be produced and the device is interactive.
38338 ripley 55
}
27497 ripley 56
\note{
57
  It is more flexible and has different default behaviour than
58
  the S version.  We use \code{main =} instead of \code{head = } for
59
  internal consistency.
60
}
61
\author{Martin Maechler}
29354 ripley 62
\seealso{
63
  \code{\link{plot.ts}} which is the basic work horse.
27497 ripley 64
}
65
\examples{
41508 ripley 66
require(graphics)
67
 
27497 ripley 68
lag.plot(nhtemp, 8, diag.col = "forest green")
61160 ripley 69
lag.plot(nhtemp, 5, main = "Average Temperatures in New Haven")
27497 ripley 70
## ask defaults to TRUE when we have more than one page:
71
lag.plot(nhtemp, 6, layout = c(2,1), asp = NA,
72
         main = "New Haven Temperatures", col.main = "blue")
73
 
74
## Multivariate (but non-stationary! ...)
41621 ripley 75
lag.plot(freeny.x, lags = 3)
27497 ripley 76
\dontrun{
30449 ripley 77
no lines for long series :
27497 ripley 78
lag.plot(sqrt(sunspots), set = c(1:4, 9:12), pch = ".", col = "gold")
79
}
80
}
81
\keyword{hplot}
82
\keyword{ts}