alashworth / test-issue-import

0 stars 0 forks source link

truncation out-of-bounds in model should throw #114

Open alashworth opened 5 years ago

alashworth commented 5 years ago

Issue by bob-carpenter Saturday Sep 03, 2016 at 13:05 GMT Originally opened as https://github.com/stan-dev/stan/issues/2053


Summary:

As pointed out by @bgoodri on stan-dev list, truncation syntax is generating

        if (y < 1) lp_accum__.add(-std::numeric_limits<double>::infinity());
        else lp_accum__.add(-poisson_ccdf_log(1, rate));

Instead it should be throwing std::domain_error with a meaningful message.

Also from @bgoodri:

For

y ~ normal(mu, sigma) T[1,];

then if y < 1, then I think it should exit but if y == 1, then it should throw an non-fatal exception. It is possible that the user wrote

parameters {
  real<lower=1> y;
  ...
}

and y just underflows to 1.

Use truncation with out of bounds.

Current Output:

Nothing---just keeps going and get failure due to -infinity log density.

Expected Output:

Appropriate warning message.

Current Version:

v2.11.0