Solved – ARIMAX with a specified nonlinear model using the arima function in R

arimaforecastingnonlinear regressionrtime series

I am interested in fitting an ARIMAX model using R.
As known, ARIMAX can be understood as a composition of ARIMA models and regression models with exogenous (independent) variables. I have a time series $Y_i$, and want to estimate the ARIMA and nonlinear coefficients. The nonlinear model is the following:

$y_i=β_0+β_1t_i+β_2d+β_3 sin(2πt_i/β_4 )+β_5 (-1^{t_i})+ε_i$, nonlinear
regression with an exogenous variable.
Where
$t_i$ =1, 2…, 60
and

d = dummy variable with 20 0's and 40 number 1's

d=c(rep(0,20),rep(1,40))

And an ARIMA model (1,1,1) for $Y_i$. Therefore, I want to estimate simultaneously the $β_i$ and the ARIMA coefficients in order to avoid the confusion between the exogenous coefficients and ARIMA coefficients. I know that $arima()$ can deal with this formulation but, how do the nonlinear model can be set within function function?. It seems that the xreg term only deals with linear parameters.

Best Answer

Do the parameters $\beta_3$ and $\beta_4$ have any particular interpretation or meaning in the context of your model? You can consider reparameterizing the model merging $\beta_3 t_i /\beta_4$ as $\theta\,t_i$. In this way the model becomes linear in the parameters and you can pass the regressors $t_i$ and $d_t$ through argument xreg in function arima.

You should include $t_i$ only once in the reparameterized model. In your model, the regressor $t_i$ is proportional to the regressor $2\pi t_i$. With this type of collinearity among the regressors the optimization algorithm won't be able to invert the system matrix.

Edit (updated answer for the new model defined in the question)

The function stats::arima does not allow you to specify this non-linear parameterization. You should modify the function arima, which is not straightforward since would require among other things recompiling the package. You can also try to create your own function, the functions that you would need are essentially: makeARIMA, KalmanLike and nlm, but this is also quite a hard work. You may ask for further guidance at Stack Overflow.

Did you find this model in any paper? If you know some application of this model published in a paper and the data are available, it would be a nice exercise to do and someone could be willing to replicate it.

Related Question