Learn R Programming

smooth (version 1.9.0)

orders: Functions that extract values from the fitted model

Description

These functions allow extracting orders and lags for ssarima(), ges() and sma() and type of model from es() and ces().

Usage

orders(object, ...)

lags(object, ...)

model.type(object, ...)

Arguments

object
Model estimated using one of the functions of smooth package.
...
Currently nothing is accepted via ellipsis.

Value

Either vector or list with values is returned. orders() in case of ssarima returns list of values:
  • ar - AR orders.
  • i - I orders.
  • ma - MA orders.

Details

orders() and lags() are usefull only for SSARIMA, GES and SMA. They return NA for other functions. This can also be applied to arima(), Arima() and auto.arima() functions from stats and forecast packages. model.type() is usefull only for ETS and CES. They return NA for other functions. This can also be applied to ets() function from forecast package.

See Also

forecast, ssarima

Examples

Run this code

x <- rnorm(100,0,1)

# Just as example. orders and lags do not return anything for ces() and es(). But model.type does.
ourModel <- ces(x, h=10)
orders(ourModel)
lags(ourModel)
model.type(ourModel)
# And as another example it does the opposite for ges() and ssarima()
ourModel <- ges(x, h=10, orders=c(1,1), lags=c(1,4))
orders(ourModel)
lags(ourModel)
model.type(ourModel)

# Finally these values can be used for simulate functions or original functions.
ourModel <- auto.ssarima(x)
ssarima(x, orders=orders(ourModel), lags=lags(ourModel), constant=ourModel$constant)
sim.ssarima(orders=orders(ourModel), lags=lags(ourModel), constant=ourModel$constant)

Run the code above in your browser using DataLab