# Time series implementation questions

**URL:** https://discourse.pymc.io/t/time-series-implementation-questions/10653
**Category:** v5
**Tags:** time\_series
**Created:** [October 21, 2022, 11:59am UTC](https://discourse.pymc.io/t/time-series-implementation-questions/10653 "2022-10-21T11:59:02Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![maedoc](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/maedoc/32/5755_2.png) [@maedoc](https://discourse.pymc.io/u/maedoc)
#### Post date: [October 21, 2022, 11:59am UTC](https://discourse.pymc.io/t/time-series-implementation-questions/10653/1 "2022-10-21T11:59:02Z")

</div>

hi,

I am aware of the built-in time series distributions, but have a question how to accomplish something similar to the follow Stan program:

```nohighlight
parameters {
   real a;
   vector[100] x_t;
}
model {
  x_t[1:] ~ normal(a * x_t[:99], 0.1);
  // make predictions with x_t
}

```

In words, `x_t` is a lag 1 autoregressive time series implemented in a “centered” form. The equivalent non-centered form would be

```nohighlight
parameters {
  real a
  vector[100] z_t;
}
model {
  vector[100] x_t;
  z_t ~ std_normal();
  x_t[1] = z_t[1];
  for (i in 1:99) x_t[i+1] = a * x_t[i] + 0.1 * z_t[i+1];
  // make predictions with x_t
}

```

My understanding is that the pymc distributions now all implement the second “non-centered” form which is usually better for MCMC sampling because it decorrelates the parameters. But, I wanted to know how I could implement the first variant by hand for performance reasons? I wasn’t able to figure this out without resorting to `pm.Potential`. Thanks in advance!

---

_[View the full topic](https://discourse.pymc.io/t/time-series-implementation-questions/10653)._
