How do I do the following
transformed parameters {
real xi[S, S]; // fix effect
vector<lower=0.0,upper=1>[D] beta[S,S];
int phiIndex = 0;
for (row in 1:S){
for (col in 1:S){
if (row == col){
xi[row, col] = fi[phiIndex];
phiIndex += 1;
}
}
}
for (row in 1:S){
for (col in 1:S){
if (row == col){
for (d in 1:D){
beta[row, col, d] = fi[phiIndex];
phiIndex += 1;
}
}
}
}
}
I am using phiIndex to increment the pointer for vector fi. The compiler does allow the declaration
int phiIndex = 0