Draws a plot of a given iNZightTS
object with the trend superimposed.
# S3 method for iNZightTS
plot(
x,
multiplicative = FALSE,
ylab = obj$currVar,
xlab = "Date",
title = "%var",
animate = FALSE,
t = 10,
smoother = TRUE,
aspect = 3,
plot = TRUE,
col = ifelse(forecast > 0, "#0e8c07", "red"),
xlim = c(NA, NA),
model.lim = NULL,
seasonal.trend = FALSE,
forecast = 0,
...
)
a time series plot (constructed with ggplot2) is returned invisibly, which can be added to if desired.
an iNZightTS
object
logical. If TRUE
, a multiplicative model is used,
otherwise an additive model is used by default.
a title for the y axis
a title for the x axis
a title for the graph
logical, if true the graph is animated
smoothing parameter
logical, if TRUE
the smoother will be drawn
the aspect ratio of the plot; it will be about ASPECT times wider than it is high
logical, if FALSE
, the graph isn't drawn
the colour of the smoothed trend line
axis limits, specified as dates
limits of the series to use for modelling/forecast
logical, if TRUE
seasonal+trend curve added
numeric, how many observations ahead to forecast (default is 0, no forecast)
additional arguments (not used)
The predictions and prediction intervals are the result of models fitted by the Holt-Winters method. The amount of predicted observations is specified by the value of `forecast`.
If animate is set to TRUE
, a scatterplot of all points in the
time series will appear followed by slowly drawn lines connecting the
points, simulating the drawing of a time series by hand.
C.C Holt (1957) Forecasting seasonals and trends by exponentially weighted moving averages, ONR Research Memorandum, Carnegie Institute 52.
P.R Winters (1960) Forecasting sales by exponentially weighted moving averages, Management Science 6, 324--342.
t <- iNZightTS(visitorsQ)
plot(t)
# Forecast plot (8 quarterly forecasts):
plot(t, forecast = 8)
Run the code above in your browser using DataLab