      // modeled param
  real&lt;lower=0&gt; tau_y;      // modeled param
}
transformed parameters {
  real&lt;lower=0&gt; sigma_y;    // derived quantity (param)
  sigma_y = pow(tau_y, -0.5);
}
model {
  tau_y ~ gamma(alpha, beta);
  mu_y ~ normal(mu_mu, sigma_mu);
  for (n in 1:N)
    y[n] ~ normal(mu_y, sigma_y);
}
generated quantities {
  real variance_y;       // derived quantity (transform)
  variance_y = sigma_y * sigma_y;
}</code></pre>
<p>In this example, <code>y[N]</code> is a modeled data vector.