fortify.tsmodel: Convert time series models (like AR, ARIMA) to 'data.frame'

Description Usage Arguments Value Examples

View source: R/base_fortify_ts.R

Description

Convert time series models (like AR, ARIMA) to data.frame

Usage

1
2
3
## S3 method for class 'tsmodel'
fortify(model, data = NULL, predict = NULL,
  is.date = NULL, ts.connect = TRUE, ...)

Arguments

model

Time series model instance

data

original dataset, needed for stats::ar, stats::Arima

predict

Predicted stats::ts If not provided, try to retrieve from current environment using variable name.

is.date

Logical frag indicates whether the stats::ts is date or not. If not provided, regard the input as date when the frequency is 4 or 12.

ts.connect

Logical frag indicates whether connects original time-series and predicted values

...

other arguments passed to methods

Value

data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
fortify(stats::ar(AirPassengers))
fortify(stats::arima(UKgas))
fortify(stats::arima(UKgas), data = UKgas, is.date = TRUE)
fortify(forecast::auto.arima(austres))
fortify(forecast::arfima(AirPassengers))
fortify(forecast::nnetar(UKgas))
fortify(stats::HoltWinters(USAccDeaths))

data(LPP2005REC, package = 'timeSeries')
x = timeSeries::as.timeSeries(LPP2005REC)
d.Garch = fGarch::garchFit(LPP40 ~ garch(1, 1), data = 100 * x, trace = FALSE)
fortify(d.Garch)

sinhrks/ggfortify documentation built on May 26, 2018, 6:24 p.m.