Unknown Truncation Point


Dear Group,

Suppose that I have a parameter theta, is it possible to use theta as a limit for another parameter, say
real theta;
real<lower=theta,> beta;
If not, is there a way to work around this?



That is possible.


Suppose there is a parameter theta, and another parameter kappa whose range depends on a function of theta, is that still possible to implement?
Please see attached an example that does not work,
trunc.stan (216 Bytes)
trunc_test.R (132 Bytes)

is there anyway to work around this?


When the parser tells you

variable "L" does not exist.
  error in 'model_bounds' at line 7, column 15
     5: parameters{
     6:   real theta;
     7:   real<lower=L> kappa;
     8: }

that is because L is not defined until after the constraints on the parameters are applied. It does parse if you change the parameters block to

  real theta;
  real<lower=-square(theta)> kappa;

although it will probably sample inefficiently.


Specifically, it’s going to be inefficient if values near that lower bound are consistent with the data.