SarimaModel-class | R Documentation |
Class SarimaModel in package sarima.
Class "SarimaModel"
represents standard SARIMA models. Objects
can be created by calls of the form
new("SarimaModel", ..., ar, ma, sar, sma)
,
using named arguments in the form slotname = value
, where
slotname
is one of the slots, see below. The arguments have
natural defaults. It may be somewhat surprising though that the
default for the variance of the innovations (slot "sigma2"
) is
NA
. The rationale for this choice is that for some calculations
the innovations' variance is not needed and, more importantly, it is
far too easy to forget to include it in the model (at least for the
author) when the variance matters. The latter may may lead silently to
wrong results if the "natural" default value of one is used when
sigma2
matters.
The models may be specified in intercept (center = 0
) or
mean-corrected (intercept = 0
) form. Setting both to non-zero
values is accepted but rarely needed.
If you waih to modify an existing object from class
"SarimaModel"
, give it as an unnamed argument to "new"
and specify only the slots to be changed, see the examples.
Use as.SarimaModel
to convert a model fitted with
stats::arima()
to "SarimaModel"
.
center
:Object of class "numeric"
,
a number, the ARIMA equation is for X(t) - center
.
intercept
:Object of class "numeric"
,
a number, the intercept in the ARIMA equation.
sigma2
:Object of class "numeric"
,
a positive number, the innovations variance.
nseasons
:Object of class "numeric"
,
a positive integer, the number of seasons. For non-seasonal models
this is NA.
iorder
:Object of class "numeric"
,
non-negative integer, the integration order.
siorder
:Object of class "numeric"
,
non-negative integer, the seasonal integration order.
ar
:Object of class "BJFilter"
,
the non-seasonal AR part of the model.
ma
:Object of class "SPFilter"
,
the non-seasonal MA part of the model.
sar
:Object of class "BJFilter"
,
the seasonal AR part of the model.
sma
:Object of class "SPFilter"
,
the seasonal MA part of the model.
Class "VirtualFilterModel"
, directly.
Class "SarimaSpec"
, directly.
Class "SarimaFilter"
, by class "SarimaSpec", distance 2.
Class "VirtualSarimaFilter"
, by class "SarimaSpec", distance 3.
Class "VirtualCascadeFilter"
, by class "SarimaSpec", distance 4.
Class "VirtualMonicFilter"
, by class "SarimaSpec", distance 5.
SARIMA models contain as special cases a number of models.
The one-argument method of modelCoef
is essentially a
definition of model coefficients for SARIMA models. The two-argument
methods request the model coefficients according to the convention of
the class of the second argument. The second argument may also be a
character string naming the target class.
Essentially, the methods for modelCoef
are a generalisation of
as()
methods and can be interpreted as such (to an extent, the
result is not necessarilly from the target class, not least because
the target class may be virtual).
signature(object = "SarimaModel", convention = "missing")
:
Converts object
to "SarimaFilter".
signature(object = "SarimaModel", convention = "SarimaFilter")
:
Converts object
to "SarimaFilter", equivalent to the
one-argument call modelCoef(object)
.
signature(object = "SarimaModel", convention = "ArFilter")
:
Convert object
to "ArFilter". An error is raised if
object
has non-trivial moving average part.
signature(object = "SarimaModel", convention = "MaFilter")
:
Convert object
to "MaFilter". An error is raised if
object
has non-trivial autoregressive part.
signature(object = "SarimaModel", convention = "ArmaFilter")
:
Convert object
to "ArmaFilter". This operation always successeds.
signature(object = "SarimaModel", convention = "character")
:
The second argument gives the name of the target class.
This is conceptually equivalent to modelCoef(object, new(convention))
.
modelOrder
gives the order of the model according to the
conventions of the target class. An error is raised if object
is not compatible with the target class.
signature(object = "SarimaModel", convention = "ArFilter")
: ...
signature(object = "SarimaModel", convention = "ArmaFilter")
: ...
signature(object = "SarimaModel", convention = "ArmaModel")
: ...
signature(object = "SarimaModel", convention = "ArModel")
: ...
signature(object = "SarimaModel", convention = "MaFilter")
: ...
signature(object = "SarimaModel", convention = "MaModel")
: ...
signature(object = "SarimaModel", convention = "missing")
: ...
The polynomials associated with object
can be obtained with the
following methods. Note that target "ArmaFilter" gives the fully
expanded products of the AR and MA polynomials, as needed, e.g., for
filtering.
signature(object = "SarimaModel", convention = "ArmaFilter")
:
' Gives the fully expanded polynomials as a list
signature(object = "SarimaModel", convention = "missing")
:
Gives the polynomials associated with the model as a list.
signature(object = "SarimaModel", convention = "ArmaFilter")
:
Give the coefficients of the fully expanded polynomials as a list.
signature(object = "SarimaModel", convention = "missing")
:
Gives the coefficients of the polynomials associated with the model as a list.
Georgi N. Boshnakov
ArmaModel
ar1 <- new("SarimaModel", ar = 0.9)
ar1c <- new("SarimaModel", ar = 0.9, intercept = 3)
ar1c
ar1m <- new("SarimaModel", ar = 0.9, center = 1)
ar1m
sm0 <- new("SarimaModel", nseasons = 12)
sm1 <- new("SarimaModel", nseasons = 12, intercept = 3)
sm1
## alternatively, pass a model and modify with named arguments
sm1b <- new("SarimaModel", sm0, intercept = 3)
identical(sm1, sm1b) # TRUE
## in the above models sigma2 is NA
## sm2 - from scratch, the rest modefy an existing model
sm2 <- new("SarimaModel", ar = 0.9, nseasons = 12, intercept = 3, sigma2 = 1)
sm2a <- new("SarimaModel", sm0, ar = 0.9, intercept = 3, sigma2 = 1)
sm2b <- new("SarimaModel", sm1, ar = 0.9, sigma2 = 1)
sm2c <- new("SarimaModel", ar1c, nseasons =12, sigma2 = 1)
identical(sm2, sm2a) # TRUE
identical(sm2, sm2b) # TRUE
identical(sm2, sm2c) # TRUE
sm3 <- new("SarimaModel", ar = 0.9, sar = 0.8, nseasons = 12, intercept = 3,
sigma2 = 1)
sm3b <- new("SarimaModel", sm2, sar = 0.8)
identical(sm3, sm3b) # TRUE
## The classic 'airline model' (from examples for AirPassengers)
(fit <- arima(log10(AirPassengers), c(0, 1, 1),
seasonal = list(order = c(0, 1, 1), period = 12)))
as.SarimaModel(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.