I have a categorical variable (drug treatment) with 6 groups.
Rather than doing redundant parameterization (6 parameters), I want to set the control treatment as the reference level such that its coefficient is zero (5 parameters).
In rjags, I could do:
for(i in 1:5){bT[i] ~ dnorm(0, 1)}
bT[6] <- 0
But when I try to do it in stan, like this:
parameters {
vector[6] bT;
}
model{
bT[1:5] ~ normal(0, 1);
bT[6] = 0;
// some likelihood function
}
It tells me that
Cannot assign to global variable 'bT' declared in previous blocks.
I found a similar post here but it does not include any code.
I am guessing I have to add something in the transformed parameters block, but it is not immediately obvious to me (a stan newb) what the correct syntax is.
Many thanks in advance -
A.L.