– Currently, the transformation_test.stan (as visible on the blog) fail to converge because the constraints were gobbled up by WordPress. I asked about this on the stan forum [here](https://discourse.mc-stan.org/t/reproducing-the-parameter-transformation-example-from-the-statmodeling-blog/7527) but after reading the comments above I figured out what went wrong.

]]>I wish this blog had either (1) a preview option or (2) the capability for a user to delete a post that they made.

Bob.

]]>Bob

___________________________

—————————

\ ^__^

\ (oo)\_______

(__)\ )\/\

||—-w |

|| ||

This is coded as

<pre>

___________________________

—————————

\ ^__^

\ (oo)\_______

(__)\ )\/\

||—-w |

|| ||

</pre>

]]>parameters { ... vector[T] epsilon; // innovations } transformed parameters { ... vector[T] eta; eta[1] = epsilon[1]; for (t in 2:T) eta[t] = rho * eta[t - 1] + epsilon[t]; }

[edit: repladed markdown with html to make WordPress happy.]

]]>If you declare something in the “parameters” block but put the associated prior on something from the “transformed parameters” block, then you also need a Jacobian.

]]>No, the lower=0 and lower=1 are not missing at all. They just got removed from the html because of the angle brackets.

Is there a way to alter the “pre” tag in html to not swallow up the angle brackets? I know that I could change to that “gt” and “lt” thing but that’s ugly because then I can’t just copy in the code.

]]>Hmmm, you might be right about this! It’s a different transformation (logit rather than 1/(1-rho^2)), but maybe the logit would do the job too here. I hadn’t thought about that.

]]>2. For now, log1m(x) is more efficient and stable than log(1 – x). We’ll automate that soon when the OCaml parser goes through.

I prefer this version of the first program:

parameters { real xi; real<lower = 0> sigma; vector[T] eta; } model { real rho = sqrt(1 - inv(xi)); eta[1] ~ normal(0, sigma); eta[2:T] ~ normal(rho * eta[1: T - 1], sigma * sqrt(1 - square(rho))); }

It’ll also be much more efficient because (a) it vectorizes multiplication by rho, and (b) uses a scalar scale parameter for eta[2:T] rather than dupliating the sqrt, square and multiplication ops to create the argument then the log in the evaluation of it.

]]>