Yes, that works when all U
s are positive.
Another idea is to have upper=0
bound and add U
to the raw values.
data {
int N;
vector[N] U; // upper bounds
...
parameters {
vector<upper=0>[N] alpha_raw;
...
transformed parameters {
vector[N] alpha = U + alpha_raw;
}
Also, vectorized bounds work in the latest CmdStan (but not yet in RStan)
data {
int N;
vector[N] U; // upper bounds
...
parameters {
vector<upper=U>[N] alpha; // upper=_ is the same shape as alpha
...