# Modelling an ARIMA model in Stan / autoregressive model with trend

The manual lays out the approach for modelling an ARMA model very clearly.

Is it possible to model an ARIMA model directly, or at least one that has an integration order of one? Or perhaps approximate it through a DLM?

Eg, you might have a DLM model defined as follows:

• \mu_t = \mu_{t-1} + \beta_{t-1} + \left[\sum_{k=1}^P \phi_k \mu_{t-k}\right] + \epsilon_t
• \beta_t = \beta_{t-1} + \omega_t

where \{\phi\} are the auto-regressive coefficients.

Is there any reason why this type of model wouldn’t work? Is this over-determined somehow? When I try this on a data set it has extremely poor mixing (every transition requires maxdepth well over 10)

Maybe another way of asking my question is as follows: how would you directly model a locally linear model where shocks display auto-regressive behaviour?

Perhaps the issue above is that I have used \sum_{k=1}^P \phi_k \mu_{t-k} when what I actually need is something like:

• \sum_{k=1}^P \phi_k (y_{t-k}-\mu_{t-k}), although this looks more like an MA model, or even
• \sum_{k=1}^P \phi_k (\mu_{t-k}-\mu_{t-k-1}), which would incorporate the differences between previous values as predictors

The second of these seems a bit more natural than my original model because it shouldn’t be the absolute value of the series that determines the locally autoregressive behaviour.

Any thoughts here welcome!