plot.tsfit {tseriesTARMA}R Documentation

Plot from fitted/forecasted time series models.

Description

Plots a time series model fit, possibly together with its forecast and forecast bands.

Usage

## S3 method for class 'tsfit'
plot(
  x,
  fit,
  plot.fit = TRUE,
  fore = NULL,
  lcols = list(series = "lightblue", fit = 4, pred = "red4", band = "red"),
  ptype = list(series = 20, fit = 1, pred = 16, band = 20),
  ltype = list(series = 1, fit = 1, pred = 1, band = 1),
  lwdt = 2,
  ...
)

Arguments

x

A time series

fit

A time series model fitted upon x, e.g. an object obtained with TARMA.fit

plot.fit

Logical. If TRUE adds the fitted values from the model.

fore

Forecast derived from fit, e.g. an object obtained with predict.TARMA if not null it adds the prediction together with its confidence bands.

lcols

List of colours for the plots.

ptype

List of point types (pch) for the plots.

ltype

List of line types (lty) for the plots.

lwdt

A common line width for the plots.

...

Additional graphical parameters.

Value

No return value, called for side effects

Author(s)

Simone Giannerini, simone.giannerini@unibo.it

Greta Goracci, greta.goracci@unibz.it

See Also

TARMA.fit and TARMA.fit2 for TARMA modelling. predict.TARMA for prediction and forecasting.

Examples

## a TARMA(1,1,1,1) model
set.seed(13)
x    <- TARMA.sim(n=200, phi1=c(0.5,-0.5), phi2=c(0.0,0.5), theta1=-0.5, theta2=0.7, d=1, thd=0.2)
fit1 <- TARMA.fit(x,tar1.lags = 1, tar2.lags = 1, tma1.lags = 1, tma2.lags = 1, d=1,
         estimate.thd = FALSE, threshold=0.2)
xp1  <- predict(fit1,x,n.ahead=5)

# plots both the fitted and the forecast
plot.tsfit(x,fit=fit1,fore=xp1);grid();

# plots only the forecast
plot.tsfit(x,fit=fit1,plot.fit=FALSE,fore=xp1);grid();

# plots only the fitted
plot.tsfit(x,fit=fit1);grid();


[Package tseriesTARMA version 0.3-4 Index]