Hi all, I’m trying extract mean of Y_pred Posterior predictive distribution

cat(file = “VB.stan”, "

data {

int N;

vector[N] dt;

vector[N] L;

vector[N] A;

}

```
parameters {
real<lower = 0> Linf;
real<lower = 0> k;
real<lower = 0> tau;
}
transformed parameters {
vector[N] mu=Linf * (1 - exp(-k * (A + dt)));
real sigma;
sigma = 1 / sqrt(tau);
}
model{
Linf ~ normal(50,10)T[0,];
k ~ normal(0, 0.1)T[0,];
tau ~ gamma(.0001, .0001);
L ~ normal(mu, sigma);
}
generated quantities {
real Y_mean[N];
real Y_pred[N];
for (i in 1:N) {
Y_mean[i] = Linf * (1 - exp(-k * (A[i] + dt[i])));
Y_pred[i] = normal_rng(Y_mean[i], sigma);
}
}
")
```

Y_pred_mean <- apply(Y_pred$Y_pred, 2, mean)

plot(L ~ A, xlab=“Longitud total (mm)”, ylab=“Edad estimada (años)”)

lines(A, Y_pred_mean)

Gave me multiple curves of Y_pred_mean,

I want to know how to extrac only the mean of all iterations for 3 chains, thanks!