mar_model {gratis} | R Documentation |
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
)
Arguments
k |
Number of components. |
p |
Non-negative integer vector giving the orders of non-seasonal AR polynomials |
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
( |
P |
Non-negative integer giving the orders of seasonal AR polynomiasl |
D |
Non-negative integer giving the orders of seasonal differencing.
Ignored if |
Phi |
A max(P) x k numeric matrix containing the seasonal AR parameters
( |
constants |
A numeric vector of length k containing |
sigmas |
A numeric vector of length k or a list of k GARCH specifications.
If it is a vector, it is assumed |
weights |
A numeric vector of length k containing the probability of
each of the component processes, |
seasonal_periods |
Either a scalar or a numeric vector of length k containing the seasonal period of each component. |
Value
A 'mar' object containing a list of k
, m
,
p
, d
, P
, D
,
phi
, Phi
, sigmas
and weights
.
Author(s)
Rob J Hyndman
See Also
Examples
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)