# Gibbs sampler for ARIMA AR(1) parameters: division by zero

Suppose the following AR(1) model:

$$y_t = \mu + \phi (y_{t-1} - \mu) + \epsilon_t$$

with $$\epsilon_t \sim \mathcal{N}(0,\sigma^2)$$. Following issue arises when sampling from $$P(\mu_i \;|\; \phi_{i-1}, \sigma^2_{i-1}, \bf{y})$$ using a Gibbs procedure. Assuming uniform $$\mu$$-prior:

$$\mu_i \sim \mathcal{N} \left(\frac{(1-\phi_{i-1})\Sigma_{t=2}^T (y_t - \phi_{i-1} y_{t-1})}{\Sigma_{t=2}^T (1-\phi_{i-1})}, \frac{\sigma^2_{i-1}}{\Sigma_{t=2}^T (1-\phi_{i-1})}\right)$$

The obvious problem is when $$\phi_{i-1} = 1$$. In such case $$1-\phi_{i-1} = 0$$ resulting in a division by zero.

Is my approach sane? I feel like I am missing something, since if it was, I should't be having this issue. Can someone elaborate?

Note: I am aware of non-stationary and the fact that I could centralize $$\bf{y}$$ to omit $$\mu$$. Still, that doesn't seem to me to explain the fundamental question above. I also went through some Bayesian econometrics literature, but have not found any mention of the above issue.

• What's the prior on $\phi$? I am guessing what ever it is, it does not support $\phi = 1$, which means that unless you start from $\phi_1 = 1$, you will never run into the problem of $\phi_{i-1} = 1$. – Greenparker Feb 6 at 21:42
• @Greenparker, indeed, excluding $\phi = 1$ with the prior solves the issue indirectly, but still leaves room for odd cases very close to 1, which would skyrocket $\mu_i$. But you got a point. – Davor Josipovic Feb 6 at 21:46
• And rightly so, because if $\phi$ is close to 1 for the model, then the true $\mu$ in the target will also be large. – Greenparker Feb 6 at 21:50
• You’d normally use a prior which is at least weakly informative for $\mu$. If you don’t have any prior information for it, it is typically a better idea to reformulate the model using an intercept instead of the unconditional mean. – hejseb Feb 7 at 6:49
• @hejseb, You think that using a normal $\mu$-prior which is conjugate with the likelihood, would solve the the division by zero entirely? (On first look, I am not convinced, but by simplifying the equations I could possibly remove it.) Concerning the intercept: I base myself mainly on Box & Jenkins literature. Intercept as in $y_t = \mu + \phi y_{t-1} + \epsilon_t$ crossed my mind, but I am unaware of any pro/contra arguments. You have any pointers? This author considers them the same: stats.stackexchange.com/a/352256/90490 which adds to the confusion. – Davor Josipovic Feb 7 at 11:03