Class SarimaModel in package sarima
SarimaModel-class.RdClass SarimaModel in package sarima.
Objects from the Class
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".
Slots
- 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.
Extends
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.
Methods
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).
- modelCoef
- signature(object = "SarimaModel", convention = "missing"): Converts- objectto "SarimaFilter".
- modelCoef
- signature(object = "SarimaModel", convention = "SarimaFilter"): Converts- objectto "SarimaFilter", equivalent to the one-argument call- modelCoef(object).
- modelCoef
- signature(object = "SarimaModel", convention = "ArFilter"): Convert- objectto "ArFilter". An error is raised if- objecthas non-trivial moving average part.
- modelCoef
- signature(object = "SarimaModel", convention = "MaFilter"): Convert- objectto "MaFilter". An error is raised if- objecthas non-trivial autoregressive part.
- modelCoef
- signature(object = "SarimaModel", convention = "ArmaFilter"): Convert- objectto "ArmaFilter". This operation always successeds.
- modelCoef
- 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.
- modelOrder
- signature(object = "SarimaModel", convention = "ArFilter"): ...
- modelOrder
- signature(object = "SarimaModel", convention = "ArmaFilter"): ...
- modelOrder
- signature(object = "SarimaModel", convention = "ArmaModel"): ...
- modelOrder
- signature(object = "SarimaModel", convention = "ArModel"): ...
- modelOrder
- signature(object = "SarimaModel", convention = "MaFilter"): ...
- modelOrder
- signature(object = "SarimaModel", convention = "MaModel"): ...
- modelOrder
- 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.
- modelPoly
- signature(object = "SarimaModel", convention = "ArmaFilter"): ` Gives the fully expanded polynomials as a list
- modelPoly
- signature(object = "SarimaModel", convention = "missing"): Gives the polynomials associated with the model as a list.
- modelPolyCoef
- signature(object = "SarimaModel", convention = "ArmaFilter"): Give the coefficients of the fully expanded polynomials as a list.
- modelPolyCoef
- signature(object = "SarimaModel", convention = "missing"): Gives the coefficients of the polynomials associated with the model as a list.
Examples
ar1 <- new("SarimaModel", ar = 0.9)
ar1c <- new("SarimaModel", ar = 0.9, intercept = 3)
ar1c
#> An object of class "SarimaModel"
#> Model: Phi(B)X(t) = intercept + e(t)
#> 
#> intercept:  3 
#> sigmaSq:  NA 
#> Non-seasonal model 
#> Order of differencing:  0 
#> 
#> ar coefficients:   0.9
#> ma coefficients:    <None>
ar1m <- new("SarimaModel", ar = 0.9, center = 1)
ar1m
#> An object of class "SarimaModel"
#> Model: Phi(B)(X(t) - center) = e(t)
#> 
#> mean:  1 
#> sigmaSq:  NA 
#> Non-seasonal model 
#> Order of differencing:  0 
#> 
#> ar coefficients:   0.9
#> ma coefficients:    <None>
sm0 <- new("SarimaModel", nseasons = 12)
sm1 <- new("SarimaModel", nseasons = 12, intercept = 3)
sm1
#> An object of class "SarimaModel"
#> Model: X(t) = intercept + e(t)
#> 
#> intercept:  3 
#> sigmaSq:  NA 
#> Period:  12 
#> Order of differencing:  0 
#> Order of seasonal differencing:  0 
#> 
#> ar coefficients:    <None>
#> ma coefficients:    <None>
#> seasonal ar coefficients:   <None>
#> seasonal ma coefficients:   <None>
## alternatively, pass a model and modify with named arguments
sm1b <- new("SarimaModel", sm0, intercept = 3)
identical(sm1, sm1b) # TRUE
#> [1] 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
#> [1] TRUE
identical(sm2, sm2b) # TRUE
#> [1] TRUE
identical(sm2, sm2c) # TRUE
#> [1] 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
#> [1] 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)))
#> 
#> Call:
#> arima(x = log10(AirPassengers), order = c(0, 1, 1), seasonal = list(order = c(0, 
#>     1, 1), period = 12))
#> 
#> Coefficients:
#>           ma1     sma1
#>       -0.4018  -0.5569
#> s.e.   0.0896   0.0731
#> 
#> sigma^2 estimated as 0.0002543:  log likelihood = 353.96,  aic = -701.92
as.SarimaModel(fit)
#> An object of class "SarimaModel"
#> Model: (1-B)(1-B^s)X(t) = Theta(B)Theta_s(B^s)e(t)
#> 
#> Intercept:  0 
#> SigmaSq:  0.0002542551 
#> Period:  12 
#> Order of differencing:  1 
#> Order of seasonal differencing:  1 
#> 
#> ar coefficients:    <None>
#> ma coefficients:   -0.401828384120966
#> seasonal ar coefficients:   <None>
#> seasonal ma coefficients:  -0.556945059922282