forecast (version 7.2)

plot.mforecast: Multivariate forecast plot

Description

Plots historical data with multivariate forecasts and prediction intervals.

autoplot will produce an equivelant plot as a ggplot object.

Usage

"plot"(x, main=paste("Forecasts from",x$method),xlab="time",...) "autoplot"(object, plot.conf=TRUE, gridlayout=NULL, ...)

Arguments

x
Multivariate forecast object of class mforecast.
object
Multivariate forecast object of class mforecast. Used for ggplot graphics (S3 method consistency).
main
Main title. Default is the forecast method. For autoplot, specify a vector of titles for each plot.
xlab
X-axis label. For autoplot, specify a vector of labels for each plot.
plot.conf
If FALSE, confidence intervals will not be plotted, giving only the forecast line.
gridlayout
A matrix of positions for the each forecast plot to be positioned.
...
additional arguments to each individual plot.

References

Hyndman and Athanasopoulos (2014) Forecasting: principles and practice, OTexts: Melbourne, Australia. http://www.otexts.org/fpp/

See Also

plot.forecast, plot.ts

Examples

Run this code

lungDeaths <- cbind(mdeaths, fdeaths)
fit <- tslm(lungDeaths ~ trend + season)
fcast <- forecast(fit, h=10)
plot(fcast)
autoplot(fcast)

carPower <- as.matrix(mtcars[,c("qsec","hp")])
carmpg <- mtcars[,"mpg"]
fit <- lm(carPower ~ carmpg)
fcast <- forecast(fit, newdata=data.frame(carmpg=30))
plot(fcast, xlab="Year")
autoplot(fcast, xlab=rep("Year",2))

Run the code above in your browser using DataCamp Workspace