Hello everyone,

First of all thanks for the StanCon—it was a great experience.

Here is a question that I have been discussing there and many suggested that I post it on the Forum.

My question is about Manual Section 28.11 *Standardizing Predictors and Outputs* (v. 2.17.0), where it is suggested that we standardize our inputs as part of optimization. The model written is a very simple one predictor population variable model of `y_{n} = alpha + beta * x_{n} + epsilon_{n}`

. I was wondering how to back out the coefficients in the generated quantities block when `x`

is actually a hierarchical variable. That is, for example:

```
data {
int<lower=0> N;
int<lower=0> G; // Number of groups
vector[N] y;
vector[N] x;
int<lower=0> group[G]; // Group indicators
}
transformed data {
vector[N] x_std;
vector[N] y_std;
x_std = (x - mean(x)) / sd(x);
y_std = (y - mean(y)) / sd(y);
}
parameters {
real alpha_std;
real beta_std;
real<lower=0> sigma_std;
}
model {
alpha_std ~ normal(0, 10);
beta_std ~ normal(0, 10);
sigma_std ~ cauchy(0, 5);
for (n in 1:N)
y_std[n] ~ normal(alpha_std + beta_std * x_std[group[n]],
sigma_std);
}
```

The formulas offered in the manual (page 361) will not be applicable in this case because of the block diagonal structure in the covariance matrices. `rstanarm`

seems to be doing it via `autoscale = TRUE`

but it’s difficult to see how I should replicate that `prior_summary`

and scaling/transforming part when I write my own lower Stan code.

Can someone offer me guidance to this for example using the same multivariate regression example in Section 9.13 (pp. 152-153)?

Sincerely,

Silvia