# Definition of ARIMA with exogenous regressors in R

I am wondering about the exact definition of ARIMA model in function arima in R when exogenous regressors are included.

I understand that arima(y, order=c(p,0,q), xreg=x) is equivalent to estimating the following equation (where $\mu_y$ and $\mu_x$ stand for the means of $y$ and $x$, respectively):

(1) $(y_t-\mu_y)=\varphi_0+\phi_1(y_{t-1}-\mu_y)+...+\varphi_p(y_{t-p}-\mu_y)+\varepsilon_t+\theta_1\varepsilon_{t-1}+...+\theta_q\varepsilon_{t-q}+\beta_1x_t$

Or is it

(2) $(y_t-\mu_y)=\varphi_0+\phi_1(y_{t-1}-\mu_y)+...+\varphi_p(y_{t-p}-\mu_y)+\varepsilon_t+\theta_1\varepsilon_{t-1}+...+\theta_q\varepsilon_{t-q}+\beta_1(x_t-\mu_x)$

(only the last term differs between (1) and (2))?

Or perhaps I got both of them wrong?

Edit: I now realize that including both {$\mu_x$ and $\mu_y$} and $\varphi_0$ in (2) was superfluous.

Looking at the documentation and the code of arima, I conclude that the following linear model with ARIMA errors is fitted when exogenous regressors are included:
$X_t^{'}$ is a row vector containing the values of the external regressors at time $t$ and $\vec{\beta}$ is a column vector containing the coefficients related to those regressors.
Thus, there is no $\varphi_0$ term and the mean $\mu_x$ is not removed from the exogenous regressors.
• Thanks for your answer! Are you sure you got all the time indices for $X$ right? They are all $t$, but maybe they should match those of $y$? Also, shouldn't $\mu_y$ be replaced by a constant like $\beta_0$ (which need not equal the mean of $y$)? Commented Oct 28, 2014 at 20:51
• Yes, you are right. I fixed the indices and renamed $\mu_y$ as $\mu$ to make it clear that it is a parameter to be estimated. Commented Oct 28, 2014 at 20:57