Learn R Programming

smooth (version 2.4.1)

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, ...)

modelType(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 useful 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. modelType() is useful 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
# NOT RUN {
x <- rnorm(100,0,1)

# Just as example. orders and lags do not return anything for ces() and es(). But modelType() does.
ourModel <- ces(x, h=10)
orders(ourModel)
lags(ourModel)
modelType(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)
modelType(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