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

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.

• As parameterized, your model isn't identifiable (choose some value for $\beta_3/\beta_4$, and then note that doubling both $\beta_3$ and $\beta_4$ leaves that ratio unchanged) - as the model stands, you can only estimate $\beta_3/\beta_4$. You have to fix that problem with your model before even considering trying to estimate it. – Glen_b Oct 15 '14 at 0:37

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.
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.
• Thanks for your comments @Glen_b and javlacalle . I have edited my post and the model has varied a little. With the new model, $beta_3$ and $beta_4$ have a particular interpretation, period and amplitude of a sinus wave. Is there any way to estimate the ARMA parameters and this model parameters in only a single stage? (not estimating first the NLM and then the ARMA). – Hector Oct 15 '14 at 8:47