I’m using rstan Version 2.21.2.
I have my code and data for the model as follows:
y <- c(8, 35, 31, 19, 38, 47, 44, 44, 29, 18);
m <- c(37, 450, 456, 61, 218, 722, 664, 481, 76, 480);
data{
int <lower=1> nm;
int y[nm];
int m[nm];
}
parameters {
real lodds;
}
transformed parameters {
real <lower=0, upper=1> p;
p = 1/(1+exp(-lodds));
}
model{
// likelihood & prior
y ~ binomial(m, p);
}
After fitting the model, I get a estimate for p. I want to be able to track my p’s as they iterate over the different observations of y and m. I see that I can’t make a parameter/ transformed parameter an array. What can I do?
Ideally I would have an model output as follows:
p1 : <estimate>
.
.
.
p10: <estimate>