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.