The Stan language offers built-in support for bounded parameters like real<lower=1,upper=2> pt
. How do I put an expression inside a constrained region? For example,
transformed data {
real lb = 1;
real ub = 2;
}
parameters {
real part1;
real part2;
}
transformed parameters {
real pt = part1 + part2;
real bounded = logit((pt - lb)/(ub - lb));
}
model {
part1 ~ std_normal();
part2 ~ std_normal();
...
}
This is similar to the built-in scaled and translated log-odds transform. Can I just do this and add the absolute Jacobian of pt
?
I’m aware that the simple example I wrote here isn’t identified. I plan to build up a multilevel regression so part1 and part2 would have different grouping structures.