Hi everyone, I’m looking for help transcribing the rounding error model from Stan to greta. The model is documented in the Stan manual, also a gist here. The Stan code is:

```
data {
int<lower=0> N;
vector[N] y;
}
parameters {
real mu;
real<lower=0> sigma_sq;
vector<lower=-0.5, upper=0.5>[N] y_err;
}
transformed parameters {
real<lower=0> sigma;
vector[N] z;
sigma = sqrt(sigma_sq);
z = y + y_err;
}
model {
target += -2 * log(sigma);
z ~ normal(mu, sigma);
}
```

I only managed to work until the transformed parameter part… not even sure if I’m doing it right in greta:

```
library(greta)
# data
set.seed(12)
y <- rnorm(20, 10, 2)
y_r <- round(y, 0)
N <- length(y)
# priors
mu <- variable()
sigma_sq <- variable(lower = 0)
y_err <- variable(lower = -0.5, upper = 0.5, dim = N)
sigma <- sqrt(sigma_sq)
z <- normal(mu, sigma, dim = N) # or is this z <- y + y_err ???
```

Mainly, I don’t know how to code for `z`

, and what should go into `distribution()`

(is it `y`

or `z`

?)