modelOrder: Get the model order and other properties of models

modelOrderR Documentation

Get the model order and other properties of models

Description

Get the model order and other properties of models.

Usage

modelOrder(object, convention, ...)

modelPoly(object, convention, ...)

modelPolyCoef(object, convention, lag_0 = TRUE, ...)

Arguments

object

a model object.

convention

convention.

lag_0

if TRUE include lag_0 coef, otherwise drop it.

...

further arguments for methods.

Details

These functions return the requested quantity, optionally requesting the returned value to follow a specific convention, see also modelCoef.

When called with one argument, these functions return corresponding property in the native format for the object's class.

Argument convention requests the result in some other format. The mental model is that the returned value is as if the object was first converted to the class specified by convention and then the property extracted or computed. Normally, the object is not actually converted to that class. one obvious reason is efficiency but it may also not be possible, for example if argument convention is the name of a virtual class.

For example, the order of a seasonal SARIMA model is specified by several numbers. The call modelOrder(object) returns it as a list with components ar, ma, sar, sma, iorder, siorder and nseasons. For some computations all that is needed are the overall AR and MA orders obtained by multiplying out the AR-like and MA-like terms in the model. The result would be an ARMA filter and could be requested by modelOrder(object, "ArmaFilter").

The above operation is valid for any ARIMA model, so will always succeed. On the other hand, if further computation would work only if there are no moving average terms in the model one could use modelOrder(object, "ArFilter"). Here, if object contains MA terms an error will be raised.

The concept is powerful and helps in writing expressive code. In this example a simple check on the returned value would do but even so, such a check may require additional care.

Author(s)

Georgi N. Boshnakov

See Also

modelCoef

Examples

m1 <- new("SarimaModel", iorder = 1, siorder = 1, ma = -0.3, sma = -0.1, nseasons = 12)
modelOrder(m1)
modelOrder(m1, "ArmaFilter")
modelOrder(m1, new("ArmaFilter"))

modelPoly(m1, "ArmaModel")
modelPolyCoef(m1, "ArmaModel")

GeoBosh/sarima documentation built on March 27, 2024, 6:31 p.m.