Hi everyone,

First, thanks for Pyro. It’s an excellent tool - I’m very excited about it.

My issue is I can’t seem to get it to do proper inference on a very simple time series inference problem. That is, I’d like to do inference on a local linear trend model on synthetic data and have Pyro recover the true parameters. Further, I’d like it to project out into the future. I’ve discovered that it does great for historical observations, but falls apart for inference in the future (where everything is unobserved). I’ve tried both VI and NUTS and both seem to be not working. I must be doing something wrong - i’d appreciate any help! Also, I’d be happy to commit this as a tutorial once this is complete. I’m sure people would appreciate a simple time series demo.

Let me show what I mean. This is the local linear trend model:

where the system is simulated out to some T and my observations of y stop at tau.

With that, I set these parameters:

```
T = 20 # Number of time indices for which we generate data
tau = 15 # The last time index for which we observe y
ep_scale = .1 # Standard deviation on epsilon error
eta_scale = .1 # Standard deviation on eta error
xi_scale = .1 # Standard deviation on xi error
```

and then create the following model, produce some synthetic data and condition on some of it.

```
def model():
delta_s, mu_s, y_s = {'delta_0': 0}, {'mu_0': 0}, {'y_0': 0}
for t in range(1, T+1):
# Variable names
delta_nm = 'delta_{}'.format(t)
delta_nm_prev = 'delta_{}'.format(t-1)
mu_nm = 'mu_{}'.format(t)
mu_nm_prev = 'mu_{}'.format(t-1)
y_nm = 'y_{}'.format(t)
# Pyro random variables
delta_s[delta_nm] = pyro.sample(delta_nm, dist.Normal(delta_s[delta_nm_prev], ep_scale))
mu_s[mu_nm] = pyro.sample(mu_nm, dist.Normal(mu_s[mu_nm_prev] + delta_s[delta_nm], eta_scale))
y_s[y_nm] = pyro.sample(y_nm, dist.Normal(mu_s[mu_nm], xi_scale))
del delta_s['delta_0'], mu_s['mu_0'], y_s['y_0']
return delta_s, mu_s, y_s
delta_s_true, mu_s_true, y_s_true = model()
observations = {'y_{}'.format(t):y_s_true['y_{}'.format(t)] for t in range(1, tau+1)}
conditioned_model = pyro.condition(model, data=observations)
```

Then, I perform inference (using NUTS here):

```
nuts_kernel = NUTS(conditioned_model, adapt_step_size=True)
hmc_posterior = MCMC(nuts_kernel, num_samples=100, warmup_steps=20).run()
```

And get results that look like this:

Which looks wrong. The inference algorithm should realize that the trend could go anywhere after our observations, yet that doesn’t happen. I get a similar issue if I use VI with a multivariate normal as a guide.

Any help is appreciated! Thanks so much