Learn R Programming

gratis (version 1.0.7)

mar_model: Specify parameters for a Mixture Autoregressive model

Description

This function allows the parameters of a mixture of k Gaussian ARIMA(p,d,0)(P,D,0)[m] processes to be specified. The output is used in simulate.mar() and generate.mar. The model is of the form $$(1-B)^{d_i}(1-B^{m_i})^{D_i} (1-\phi_i(B))(1-\Phi_i(B)) y_t = c_i + \sigma_{i,t}\epsilon_t$$ with probability \(\alpha_i\), where \(B\) is the backshift operator, \(m_i\) is the seasonal period, \(\epsilon_t\) is a N(0,1) variate, and \(\phi_i(B)\) and \(\Phi_i(B)\) are polynomials in B of order \(d_i\) and \(D_i\) respectively. If any argument is NULL, the corresponding parameters are randomly selected. When randomly selected, the AR parameters are uniformly sampled from the stationary region, p is in {0,1,2,3}, d is in {0,1,2}, P is in {0,1,2} and D is in {0,1}. The model orders are uniformly sampled. The constants are uniformly sampled on (-3,3). The sigmas are uniformly sampled on (1,5) and the weights are uniformly sampled on (0,1). The number of components is uniformly sampled on {1,2,3,4,5}.

Usage

mar_model(
  k = NULL,
  p = NULL,
  d = NULL,
  phi = NULL,
  P = NULL,
  D = NULL,
  Phi = NULL,
  constants = NULL,
  sigmas = NULL,
  weights = NULL,
  seasonal_periods = 1L
)

Value

A `mar` object containing a list of k, m, p, d, P, D, phi, Phi, sigmas and weights.

Arguments

k

Number of components.

p

Non-negative integer vector giving the orders of non-seasonal AR polynomials \(\phi_i(B)\). Ignored if phi provided.

d

Non-negative integer vector giving the orders of non-seasonal differencing.

phi

A max(p) x k numeric matrix containing the non-seasonal AR parameters (\(\phi_{1,i},\dots,\phi_{p,i}\)), \(i=1,\dots,k\) for each component.

P

Non-negative integer giving the orders of seasonal AR polynomiasl \(\Phi_i(B)\). Ignored if seasonal.periods==1 or Phi provided.

D

Non-negative integer giving the orders of seasonal differencing. Ignored if seasonal.periods==1.

Phi

A max(P) x k numeric matrix containing the seasonal AR parameters (\(\Phi_{1,i},\dots,\phi_{P,i}\)), \(i=1,\dots,k\) for each component. Ignored if seasonal.periods==1.

constants

A numeric vector of length k containing \(c_1,\dots,c_k\).

sigmas

A numeric vector of length k or a list of k GARCH specifications. If it is a vector, it is assumed \(\sigma_{i,t} = \sigma_i\) and sigmas = \(\sigma_1,\dots,\sigma_k\). If it is a list, each element should be the output from fGarch::garchSpec().

weights

A numeric vector of length k containing the probability of each of the component processes, \(\alpha_1,\dots,\alpha_k\).

seasonal_periods

Either a scalar or a numeric vector of length k containing the seasonal period of each component.

Author

Rob J Hyndman

See Also

simulate.mar

Examples

Run this code
if (FALSE) { # require("fGarch", quietly = TRUE)
n <- 100
# Quarterly MAR model with randomly selected parameters
model1 <- mar_model(seasonal_periods = 4)

# Daily MAR model with randomly selected parameters
model2 <- mar_model(seasonal_periods = c(7, 365))

# MAR model with constant variances
# containing an AR(1) component and an AR(2) component
phi <- cbind(c(0, 0.8, 0), c(0, 0.6, 0.3))
weights <- c(0.8, 0.2)
model3 <- mar_model(phi = phi, d = 0, sigmas = c(1, 2), weights = weights)

# MAR model with heteroskedastic errors
sigmas.spec <- list(
  fGarch::garchSpec(model = list(alpha = c(0.05, 0.06))),
  fGarch::garchSpec(model = list(alpha = c(0.05, 0.05)))
)
model4 <- mar_model(phi = phi, sigmas = sigmas.spec, weights = weights)
}

Run the code above in your browser using DataLab