I need to estimate specific lag ARMA model. Here is an example.
ts1 <- arima.sim(list(order = c(0, 0, 5), ma = c(0, 0.7, 0, 0, 0.1)), n = 1000)
The above model is $X_t = Z_t + 0.7 Z_{t-2} +0.1 Z_{t-5}$, where ${ Z_t}$ is white noise.
Is it possible to estimate this model in R? I tried arima
function and I haven't found the option to specify the specific lag.
If it is not possible in R, is there any specific reason?
Best Answer
The problem to be solved here is to estimate an ARIMA model in R and set some of the coefficients in the model to be constrained to be equal to zero.
Specifically, the task is to estimate an ARIMA(0,0,5) model, or equivalently an MA(5) model, and set the moving average terms at lags 1, 3, and 4, equal to zero. In addition, the constant term is also to be constrained to equal zero.
To do this, we use the arima()
function and make use of the fixed
argument. The fixed argument allows us to set these constraints. The arima()
help page (by typing ?arima
in R) tells us about the fixed
argument:
fixed
optional numeric vector of the same length as the total number of parameters. If supplied, only NA entries in fixed will be varied.
In R, we can estimate the aforementioned model with constraints by running the code shown below:
# Estimate MA(5) model with constraints using fixed=c() arima(x=ts1, order=c(0,0,5), fixed=c(0,NA,0,0,NA,0))
Let's take a closer look at fixed=c(0,NA,0,0,NA,0)
.
- The first 0 in the vector constrains the MA term at lag 1 to equal to zero.
- The next element in the vector, NA, refers to the MA term at lag 2 and by specifying NA (as opposed to 0) we impose no constraint.
- The next two 0's in the vector constrain the MA terms at lags 3 and 4 to equal zero.
- The second NA refers to the MA term at lag 5 and sets no constraint.
- The last element in the vector is a 0 and this has the function of setting the constant term equal to zero.
In general, the elements in the fixed
vector will refer to AR terms then MA terms and finally the constant – in that sequence. Again, note that the length of the fixed
vector should equal the length of the total number of parameters to be estimated. For example, in an MA(5) model (as above), there are 6 parameters to be estimated (5 MA terms and 1 constant) and that's the reason why there are 6 elements in the fixed
vector.
Similar Posts:
- Solved – How to estimate certain parameters of an AR model in R
- Solved – Is this a bug in auto arima or am I doing something wrong
- Solved – Minimizing the norm of a vector of parameters
- Solved – auto.arima vs corARMA: AR coefficient greater than 1
- Solved – How to use equalities as constrains with constrOptim in R