# Bayesian time series - more weight on recent observations?

Note: I'm a stats novice, please let me know if any of these terms are unclear or misused and I'll update the question!

I'd like to predict future values of a time series. More precisely, I'm interested in the distribution of the next value.

I've chosen a normal/Gaussian prior. I see that I can calculate my new posterior distribution by solving the conjugate prior (https://en.wikipedia.org/wiki/Conjugate_prior, Continuous Distributions section, normal with known variance).

This seems to treat all observations of my time series equally. What if my time series has an underlying trend upward or down - is there a way to represent and quantify this?

For example, I've taken an existing time series with ~30 data points in the range of 30-50. I now add 10 fake data points that are double the max observed value. This barely moves my distribution's mean by ~4. This is across a range of mean/variance combinations for my prior. With 25% of my observations so far above the prior's mean, and especially because they all occur recently, my intuition is that I should see a large shift in posterior mean and posterior variance.

Is my intuition wrong, or is there something like a "Bayes moving normal" that I can use?

• Your issue has less to do with Bayesian estimation and more to do with your choice of time series model. If you believe your model has a trend you can model your data as a function of time or use an auto - regressive model with a drift. Exponential weighting can also be used in most settings. I would encourage you to look into ARIMA models as they may accomplish a lot of what you are looking for. These models can be estimated in either a Bayesian or frequentest setting. – Zachary Blumenfeld Jan 22 '16 at 2:39
• I agree with Zachary. As soon as I read 'I've chosen a normal/gaussian prior' I asked myself: "prior for what? What's the model?" Also, in the paragraph after that, well, weighting observations differently isn't really connected to the idea of a trend explaining your time series. Also there are different types of trend (stochastic and deterministic). Hope this helps. – Taylor Jan 22 '16 at 4:34

Your question about Bayesian Time Series falls perhaps into Bayesian state-space models (Bayesian Filtering) and the problem could be formulated under the same structure.

Within Bayesian state-space models, under the assumption of linearity, you could structure you dynamics as in a Kalman Filter (the "easiest" you can get).

$$x_{k+1} = Ax + w_k \\ y_{k+1} = Hx + v_k$$

where, if you assume the latent variables are the weights given to the AR factors (down until $t-n$):

$$x_k = x_{k-1} = x = \begin{bmatrix} a_0 \\ \vdots \\ a_n \end{bmatrix} = a$$

and

$$H = [y_{k} \quad y_{k-1} \quad .. ] \dot \quad a$$

A Bayesian state-space model gives you:

• the possibility to fine-tune the weight given to the latest measurements
• the possibility to have the weights on the AR factors adapted in response to new data

Your questions seemed concerned about fine-tuning how much weight should be given to the latest measurements. If we model the measurement noise $v_k$ where $v_k \sim N(0, e_v)$ "smaller" (*) than the model uncertainty, the filter will rely on the latest measurement and update the AR factors $a$ faster in response to high prediction errors

You can see how some AR, MA and ARMA models can be refactored into state-space models here

(*) lot's to say about this - I am trying to convey the idea here. See "Kalman gain tuning"