Modeling some components of a vector that are equal

See my response to your previous post, here.

I would suggest you only specify 62 elements of logitlambda, then copy the last element to logit[62:N]. This should achieve what you are looking for.

parameters{
    // 1. specify logitlambda as a parameter
    // 2. only specify 62 elements of logitlambda 
    vector[62] logitlambda; 
}
transformed parameters{
    // 3. treat lambda as a transformed parameter
    vector[N] lambda;

    lambda[1:61] = inv_logit(logitlambda[1:61]);
    // 4. Assign the last element of logitlambda to the last 62:N elements of lambda
    lambda[62:N] = inv_logit(logitlambda[62]);
}
model {
    // 5. Put a prior on logitlambda; no need for temp
    logitlambda ~ normal(0, 10);
}

As a side-note, transformed parameters in the model block are not saved. If you want to analyze them after drawing samples, you need to either put them in the transformed parameters block or generated quantities block.

1 Like