plot-methods: ~~ Methods for Function 'plot' in Package 'x12' ~~

plot-methodsR Documentation

~~ Methods for Function plot in Package x12 ~~

Description

Plot function for x12 output in package x12.

Usage

## S4 method for signature 'x12Single'
plot(x, original=TRUE, sa=FALSE, trend=FALSE, log_transform=FALSE,
  ylab="Value", xlab="Date", main="TS", col_original="black", col_sa="blue",
  col_trend="green", lwd_original=1, lwd_sa=1, lwd_trend=1, lty_sa=1, lty_trend=1, ytop=1,
  showAllout=FALSE, showAlloutLines=FALSE, showOut=NULL, annComp=TRUE, annCompTrend=TRUE,
  col_ao="red", col_ls="red", col_tc="red", col_annComp="grey", lwd_out=1, cex_out=1.5,
  pch_ao=4, pch_ls=2, pch_tc=23, plot_legend=TRUE, legend_horiz=TRUE, legend_bty="o",
  forecast=FALSE, backcast=FALSE,
  showCI=TRUE, col_fc="#2020ff", col_bc="#2020ff", col_ci="#d1d1ff",
  col_cishade="#d1d1ff", lty_original=1, lty_fc=2, lty_bc=2, lty_ci=1, lwd_fc=1, lwd_bc=1,
  lwd_ci=1, points_bc=FALSE, points_fc=FALSE, points_original=FALSE, showLine=FALSE,
  col_line="grey", lty_line=3, ylim=NULL, span=NULL, ...)
## S4 method for signature 'x12Batch'
plot(x, what="ask",original=TRUE, sa=FALSE, trend=FALSE, log_transform=FALSE,
  ylab="Value", xlab="Date", main="TS", col_original="black", col_sa="blue",
  col_trend="green", lwd_original=1, lwd_sa=1, lwd_trend=1, lty_sa=1, lty_trend=1, ytop=1,
  showAllout=FALSE, showAlloutLines=FALSE, showOut=NULL, annComp=TRUE, annCompTrend=TRUE,
  col_ao="red", col_ls="red", col_tc="red", col_annComp="grey", lwd_out=1, cex_out=1.5,
  pch_ao=4, pch_ls=2, pch_tc=23, plot_legend=TRUE, legend_horiz=TRUE, legend_bty="o",
  forecast=FALSE, backcast=FALSE,
  showCI=TRUE, col_fc="#2020ff", col_bc="#2020ff", col_ci="#d1d1ff",
  col_cishade="#d1d1ff", lty_original=1, lty_fc=2, lty_bc=2, lty_ci=1, lwd_fc=1, lwd_bc=1,
  lwd_ci=1, points_bc=FALSE, points_fc=FALSE, points_original=FALSE, showLine=FALSE,
  col_line="grey", lty_line=3, ylim=NULL, span=NULL, ...)
## S4 method for signature 'x12Output'
plot(x, original=TRUE, sa=FALSE, trend=FALSE, log_transform=FALSE,
  ylab="Value", xlab="Date", main="TS", col_original="black", col_sa="blue",
  col_trend="green", lwd_original=1, lwd_sa=1, lwd_trend=1, lty_sa=1, lty_trend=1, ytop=1,
  showAllout=FALSE, showAlloutLines=FALSE, showOut=NULL, annComp=TRUE, annCompTrend=TRUE,
  col_ao="red", col_ls="red", col_tc="red", col_annComp="grey", lwd_out=1, cex_out=1.5,
  pch_ao=4, pch_ls=2, pch_tc=23, plot_legend=TRUE, legend_horiz=TRUE, legend_bty="o",
  forecast=FALSE, backcast=FALSE, showCI=TRUE,
  col_fc="#2020ff", col_bc="#2020ff", col_ci="#d1d1ff", col_cishade="#d1d1ff",
  lty_original=1, lty_fc=2, lty_bc=2, lty_ci=1, lwd_fc=1, lwd_bc=1, lwd_ci=1,
  points_bc=FALSE, points_fc=FALSE, points_original=FALSE,
  showLine=FALSE, col_line="grey", lty_line=3, ylim=NULL, span=NULL, ...)
				

Arguments

x

object of class x12Output-class or x12Single-class.

original

logical defining whether the original time series should be plotted.

sa

logical defining whether the seasonally adjusted time series should be plotted.

trend

logical defining whether the trend should be plotted.

log_transform

logical defining whether the log transform should be plotted.

showAllout

logical defining whether all outliers should be plotted.

showOut

character in the format "TypeYear.Seasonalperiod" defining a specific outlier to be plotted.

annComp

logical defining whether an annual comparison should be performed for the outlier defined in showOut.

forecast

logical defining whether the forecasts should be plotted.

backcast

logical defining whether the backcasts should be plotted.

showCI

logical defining whether the prediction intervals should be plotted.

ylab

label of y-axis.

xlab

label of x-axis.

main

plot title.

col_original

color of the original time series.

col_sa

color of the seasonally adjusted time series.

col_trend

color of the trend.

lwd_original

line width of the original time series.

lwd_sa

line width of the seasonally adjusted time series.

lwd_trend

line width of the trend.

lty_original

line type of the original time series.

lty_sa

line type of the seasonally adjusted time series.

lty_trend

line type of the trend.

ytop

multiplication factor for ylim.

showAlloutLines

logical specifying if vertical lines should be plotted with the outliers.

annCompTrend

logical specifying if the trend of the annual comparison should be plotted.

col_ao

color of additive outliers.

col_ls

color of level shifts.

col_tc

color of transitory changes.

col_annComp

color of annual comparison.

lwd_out

line width of outliers.

cex_out

magnification factor for size of symbols used for plotting outliers.

pch_ao

symbols used for additive outliers.

pch_ls

symbols used for level shifts.

pch_tc

symbols used for transitory changes.

plot_legend

logical specifying if a legend should be plotted.

legend_horiz

Orientation of the legend

legend_bty

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n".

col_fc

color of forecasts.

col_bc

color of backcasts.

col_ci

color of prediction interval.

col_cishade

color of prediction interval shading.

lty_fc

line type of forecasts.

lty_bc

line type of backcasts.

lty_ci

line type of prediction interval.

lwd_fc

line width of forecasts.

lwd_bc

line width of backcasts.

lwd_ci

line width of prediction interval.

points_bc

logical specifying if backcasts should additionally be indicated with points.

points_fc

logical specifying if forecasts should additionally be indicated with points.

points_original

logical specifying if the original time series should additionally be indicated with points.

showLine

logical indicating if a boundary line should be drawn before/after fore-/backcasts.

col_line

color of showLine.

lty_line

line type of showLine.

ylim

range of the y-axis.

span

vector of length 4, limiting the data used for the plot.
Start and end date of said time interval can be specified by 4 integers in the format c(start year, start seasonal period, end year, end seasonal period)

what

How multiple plots should be treated. "ask" is the only option at the moment.

...

ignored.

Methods

signature(x = "x12Output")
signature(x = "x12Single")

Author(s)

Alexander Kowarik, Angelika Meraner

See Also

plotSpec, plotSeasFac, plotRsdAcf

Examples

## Not run: 
s <- new("x12Single",ts=AirPassengers,tsName="air")
s <- setP(s,list(estimate=TRUE,regression.variables="AO1950.1",outlier.types="all",
  outlier.critical=list(LS=3.5,TC=2.5),backcast_years=1/2))
s <- x12(s)
#w/o outliers
plot(s@x12Output,sa=TRUE,trend=TRUE,original=FALSE)
plot(s)
#with (all) outliers
plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,log_transform=TRUE,lwd_out=1,pch_ao=4)
plot(s,showAllout=TRUE,sa=TRUE,trend=TRUE,original=FALSE,showAlloutLines=TRUE,
  col_tc="purple")#,log_transform=TRUE)#,lwd_out=3)
plot(s,showAllout=TRUE,span=c(1951,1,1953,12),points_original=TRUE,cex_out=2)
#with showOut
plot(s,showOut="AO1960.Jun",sa=FALSE,trend=FALSE,annComp=TRUE,log_transform=TRUE)
plot(s,showOut="AO1958.Mar",sa=TRUE,trend=TRUE,annComp=TRUE,annCompTrend=FALSE)
plot(s,showOut="AO1950.Jun",annComp=FALSE,cex_out=3,pch_ao=19,col_ao="orange")
plot(s,showOut="TC1954.Mar",span=c(1954,1,1955,12))
plot(s,showOut="TC1954.Feb",col_tc="green3")

#w/o legend
plot(s,showAllout=TRUE,plot_legend=FALSE)
plot(s,plot_legend=FALSE)
plot(s,showOut="AO1950.1",plot_legend=FALSE,lwd_out=2,col_ao="purple")
plot(s,showOut="TC1954.Feb",col_tc="orange",col_ao="magenta",plot_legend=FALSE)
plot(s,showOut="AO1950.1",col_tc="orange",col_ao="magenta",plot_legend=FALSE)

#Forecasts & Backcasts
plot(s,forecast=TRUE)
plot(s,backcast=TRUE,showLine=TRUE)
plot(s,backcast=TRUE,forecast=TRUE,showCI=FALSE)
plot(s,forecast=TRUE,points_fc=TRUE,col_fc="purple",lty_fc=2,lty_original=3,
  lwd_fc=0.9,lwd_ci=2)
plot(s,sa=TRUE,plot_legend=FALSE)

#Seasonal Factors and SI Ratios
plotSeasFac(s)
#Spectra
plotSpec(s)
plotSpec(s,highlight=FALSE)
#Autocorrelations of the Residuals
plotRsdAcf(s)
plotRsdAcf(s,col_acf="black",lwd_acf=1)

## End(Not run)

statistikat/x12 documentation built on May 21, 2022, 8:01 a.m.