Learn R Programming

tsoutliers (version 0.6-8)

plot.tsoutliers: Display Outlier Effects Detected by tsoutliers

Description

This function displays the output from function tso.

Usage

# S3 method for tsoutliers
plot(x, 
  args.lines.y = list(col = "gray80"), args.lines.yadj = list(col = "blue"),
  args.lines.effects = list(type = "s", col = "red"),   
  args.points = list(col = "gray80", bg = "red", pch = 21), plot.points = TRUE, 
  args.x.axis = list(at = pretty(time(x$y)), tcl = -0.5, lwd = 0, lwd.ticks = 1),
  args.y.axis = list(at = pretty(x$y), tcl = -0.5, lwd = 0, lwd.ticks = 1),
  args.effects.axis = list(at = pretty(x$effects), tcl = -0.5, lwd = 0, lwd.ticks = 1),
  ...)

Value

None.

Arguments

x

a list of class tsoutliers as returned by tso.

args.lines.y

a list. Arguments passed to lines to customize the line displaying the original series.

args.lines.yadj

a list. Arguments passed to lines to customize the line displaying the series adjusted for outliers effects.

args.lines.effects

a list. Arguments passed to lines to customize the line displaying the for outliers effects.

args.points

a list. Arguments passed to lines to customize the points drawn if plot.points = TRUE.

plot.points

a logical indicating whether the time points of the outliers should be drawn as points over the original series.

args.x.axis

a list. Arguments to be passed to axis to customize the x-axis (time).

args.y.axis

a list. Arguments to be passed to axis to customize the y-axis for the original series.

args.effects.axis

a list. Arguments to be passed to axis to customize the y-axis for the outliers effects.

...

further arguments to be passed to par.

Details

Instead of using the ellipsis, ..., arguments passed to other functions are defined by means of a list. This approach is taken because there may be a single argument name to be used in different parts of the plot with a different value. For example, the argument col can be defined in args.lines.y to indicate the color of the original series, e.g. col = "gray80"; at the same time the color for the adjusted series can be defined in the list argument args.lines.yadj.

For further customizations, the source code of the function can be modified relatively easy. Alternatively, a similar plot can be displayed simply as: plot(cbind(x$y, x$yadj, x$effects), plot.type = "multiple"). In this way, the plot can be fully customized by setting the desired arguments to to plot or to ancillary functions that can be called afterwards.

See Also

tso.