Next: User Function Help File Up: Time Series Macros Help Previous: testnfreq()   Contents


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

Keywords: plotting, time domain
tsplot(Y, Start, delta_t) does a line plot of the columns of Y,
considered as equally spaced discrete parameter time series, against

The time corresponding to the first row of Y is Start and it is
incremented by delta_t for each additional row of Y.  That is row J is
plotted at time Start + (J-1)*delta_t.

You can provide a default value for Start and delta_t by setting
variables START and DELTAT appropriately.  You can also provide a time
unit to be used in constucting a graph title and x-axis label by
setting variable 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 without 'lines:T'.

No symbols are plotted when 'symbols:Symb' is not an argument.  See

tsplot(Y, Start, delta_t, timeunit:Unit), where Unit is a CHARACTER
scalar different from "", for example "year", does the same except that
Unit is used in constructing the default title and x-axis label.

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 "".

tsplot(Y, Start ...) does the same but uses the value of variable DELTAT
for delta_t, when DELTAT is a positive REAL scalar, and 1 otherwise.

tsplot(Y ...) does the same, but uses the value of variable START for
Start, when START is a non MISSING REAL scalar, and 0 otherwise;
delta_t is either DELTAT or 1, when DELTAT is not a positive REAL

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.

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

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

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' makes a
combination impulse and line plot and 'lines:F' suppresses drawing
lines.  See regular help topic 'graph_keys' for details.

Suppose the columns of x contain 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

Suppose rhohat contains autocorrelation functions for the columns of x,
starting with lag 1 month, perhaps computed as rhohat <- autocor(x,60).
  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.

See also ffplot(), autocor().

Gary Oehlert 2003-01-15