Help with a non-converging Gaussian dynamic system

params_pr ~ normal(0, 1);

Yeah so whenever you do the non-centering you start with something with a prior of normal(0, 1) and then transform it and make the transformed variable have the distribution you want.

So if you want:

x ~ normal(a, b);

Do:

parameters {
  real x_z;
}
transformed parameters {
  real x = a + b * x_z;
}
model {
  x_z ~ normal(0, 1);
}

You can equivalently code this like:

parameters {
  real<offset = a, multiplier = b> x;
}
model {
  x ~ normal(a, b);
}

But in explaining the non-centered I like the longer version. Here’s some more discussion on it: Updated non-centered parametrization with offset and multiplier

x_t \sim N(x_{t - 1}, \sigma) works similarly to above. Here is a verbose example (you’d do this with vectors and loops normally):

To non-center:

x1 ~ normal(0, b);
x2 ~ normal(x1, b);

Do:

parameters {
  real x1_z;
  real x2_z;
}
transformed parameters {
  real x1 = b * x1_z;
  real x2 = x1 + b * z2_z; // note, can use the transformed x1 here
}
model {
  x1_z ~ normal(0, 1);
  x2_z ~ normal(0, 1);
}

Edit: Fixed typo in eq.

1 Like