descriptive-plots {bsts}R Documentation

Descriptive Plots

Description

Plots for describing time series data.

Usage

  DayPlot(y, colors = NULL, ylab = NULL, ...)
  MonthPlot(y, seasonal.identifier = months, colors = NULL, ylab = NULL, ...)
  YearPlot(y, colors = NULL, ylab = NULL, ylim = NULL, legend = TRUE, ...)

Arguments

y

A time series to plot. Must be of class ts, or zoo. If a zoo object then the timestamps must be of type Date, yearmon, or POSIXt.

seasonal.identifier

A function that takes a vector of class POSIXt (date/time) and returns a character vector indicating the season to which each element belongs. Each unique element returned by this function returns a "season" to be plotted. See weekdays, months, and quarters for examples of how this should work.

colors

A vector of colors to use for the lines.

legend

Logical. If TRUE then a legend is added to the plot.

ylab

Label for the vertical axis.

ylim

Limits for the vertical axis. (a 2-vector)

...

Extra arguments passed to plot or lines.

Details

DayPlot and MonthPlot plot the time series one season at a time, on the same set of axes. The intent is to use DayPlot for daily data and MonthPlot for monthly or quarterly data.

YearPlot plots each year of the time series as a separate line on the same set of axes.

Both sets of plots help visualize seasonal patterns.

Value

Returns invisible{NULL}.

See Also

monthplot is a base R function for plotting time series of type ts.

Examples

## Plot a 'ts' time series.
data(AirPassengers)
par(mfrow = c(1,2))
MonthPlot(AirPassengers)
YearPlot(AirPassengers)

## Plot a 'zoo' time series.
data(turkish)
par(mfrow = c(1,2))
YearPlot(turkish)
DayPlot(turkish)


[Package bsts version 0.9.10 Index]