Next: Graphical Interface Help File Up: Time Series Macros Help Previous: testnfreq()   Contents

tsplot()

Usage:
tsplot(y, times [,symbols:Symb] [,lines:F] [,impulse:T]
  [,timeunit:Unit] [,graphics keywords]), y a REAL matrix, times a REAL
  vector with length(time) = nrows(y), Symb a REAL or CHARACTER scalar,
  vector or matrix, Unit a CHARACTER scalar
tsplot(y [,start [,deltat]] [,symbols:Symb] [,lines:F] [,impulse:T]
  [,timeunit:Unit] [,graphics keywords]), Start and delta_t > 0 REAL
  scalars



Keywords: plotting, time domain
                                  Usage
tsplot(Y, Times) does a line plot of the columns of REAL matrix y vs
Times, a REAL vector whose non MISSING values must be in increasing
order.

tsplot(Y, Start, Delta_t) does the same using Times = Start +
Delta_t*run(0,nrows(Y)-1).  That is, the plotting times are equally
spaced starting with Start and incrementing by Delta_t.

tsplot(Y, Start) does the same using a default value for Delta_t.

tsplot(Y) does the same using default values for Start and Delta_t.

Defaults for Start and Delta_t are taken from variables START and
DELTAT, if they exist and are non-missing REAL scalars with DELTAT > 0.
When they do not exist the defaults for Start and Delta_t are 0 and 1,
respectively.

You can provide a time unit to be used in constucting a graph title and
x-axis label by setting variable TIMEUNIT or by using keyword
'timeunit'.  See below.

You can use the usual graphic keywords, including 'title', 'xlab',
'ylab', 'xmin', 'xmax', 'ymin', 'ymax', 'linetype' and 'impulse'.

With 'impulse:T', no connecting lines are drawn unless 'lines:T' is also
an argument.

Without 'symbols:Symb', no symbols are plotted unless 'lines:F' is an
argument and 'impulse:T' is not an argument.  See below.

                            Keyword timeunit
tsplot(Y, Times, timeunit:Unit) and tsplot(Y, Start, Delta_t,
timeunit:Unit)  do the same except that Unit is used in constructing
the default title and x-axis label.  Unit must be a CHARACTER scalar
such as "year" that is different from "".

Unit should be specified consistantly with Delta_t.  For example, with
monthly data and Delta_t = 1/12, Unit should be "year", while with
delta_t = 1, Unit should be "month".

Without keyword 'timeunit', the default title and x-axis label will be
constructed from the value of CHARACTER scalar TIMEUNIT, if it exists
and differs from "".

                             Keyword symbols
tsplot(Y, Times, symbols:Symb) and tsplot(Y [,Start ,[Delta_t]],
symbols:Symb) does the same, except that plotting symbols are taken from
REAL or CHARACTER scalar, vector or matrix Symb.  When Symb is a scalar,
it will be used for every point.  When Symb is a vector of length
ncols(Y), Symb[j] will be the plotting symbol for column j.  See
chplot() for further details.

'symbols:?'  is a special case.  It specifies that plotting symbols will
be 1, 2, ..., nrows(y) when Y is a vector and 1, 2, ..., ncols(y) for
each column of Y when ncols(Y) > 1.

                             Keyword impulse
tsplot(Y, Times, impulse:T, ...) and tsplot(Y [,Start ,[Delta_t]],
impulse:T, ...) do the same, except an "impulse" plot is drawn rather
than a line plot.  If you want both, also include 'lines:T' as an
argument.

                              Keyword lines
tsplot(Y, Times, lines:F, ...) and tsplot(Y [,Start ,[Delta_t]],
lines:F, ...) do the same, except that no lines or impulses are drawn.
If symbols are not supplied, the symbols are the default symbols drawn
by plot().

                            Keyword graphics
All the usual graphic keywords can be used, including 'impulse',
'lines', 'title', 'xlab', 'ylab', 'xaxis', 'yaxis', 'xmin', 'xmax',
'ymin', 'add', 'linetype', etc.

In particular, 'impulse:T' draws an impulse plot without lines unless
'lines:T'is also an argument.  See regular help topic 'graph_keys' for
details.

                                Examples
Suppose the columns of x contain 10 years of monthly data starting in
January, 1948.  Then
  Cmd> tsplot(x, 1948, 1/12, symbols:"\1",xlab:"Year")

will make a plot of the columns of x against time in years, using a
small triangle as plotting symbol.  If DELTAT has value 1/12, argument 3
can be omitted.  If also variable START is 1948, argument 2 can be
omitted.

 Cmd> tsplot(x,1948+run(0,119)/12, symbols:"\1",xlab:"Year")

makes the same plot, ignoring DELTAT and START.

Suppose rhohat contains autocorrelation functions for the columns of x,
starting with lag 1 month, perhaps computed as rhohat <- autocor(x,60).
Then
  Cmd> tsplot(rhohat,1/12,1/12,impulse:T,ymin:-1,ymax:1,\
       xlab:"Lag (Years)", ylab:"Autocorrelation",\
       title:"Autocorrelation functions for x")

makes an impulse plot of the autocorrelation functions.

If you wanted the lags in months, use tsplot(rhohat,1,1,...,xlab:"Lag
(months)",...)  After DELTAT <- 1/12, simply tsplot(rhohat,DELTAT,
impulse:T, ...) would produce the same plot.

                             Cross reference
See also ffplot(), autocor().


Gary Oehlert 2006-01-30