Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need error messages for various truncation situations #22

Closed
seantalts opened this issue Dec 18, 2018 · 6 comments
Closed

Need error messages for various truncation situations #22

seantalts opened this issue Dec 18, 2018 · 6 comments

Comments

@seantalts
Copy link
Member

seantalts commented Dec 18, 2018

In the current compiler, this model throws a couple of errors we aren't throwing:

model { 1 ~ bernoulli(0.2) T[0.1, 1.1]; }

, namely

SYNTAX ERROR, MESSAGE(S) FROM PARSER:
No matches for: 

  real ~ bernoulli_cdf(real)

Available argument signatures for bernoulli_cdf:

  int ~ bernoulli_cdf(real)
  int ~ bernoulli_cdf(real[ ])
  int ~ bernoulli_cdf(vector)
  int ~ bernoulli_cdf(row_vector)
  int[ ] ~ bernoulli_cdf(real)
  int[ ] ~ bernoulli_cdf(real[ ])
  int[ ] ~ bernoulli_cdf(vector)
  int[ ] ~ bernoulli_cdf(row_vector)

Lower truncation not defined for specified arguments to bernoulli
 error in '../stanc3/test.stan' at line 2, column 34
  -------------------------------------------------
     1: model {
     2:   1 ~ bernoulli(0.2) T[0.1, 1.1];
                                         ^
     3: }
  -------------------------------------------------


make: *** [../stanc3/test.hpp] Error 253

that first error message might be spurious given that 1 could also be an int.

@bob-carpenter
Copy link
Contributor

bob-carpenter commented Dec 18, 2018 via email

@seantalts
Copy link
Member Author

Those error messages are coming from Stan on develop, I can try pulling again and see if they go away.

@seantalts
Copy link
Member Author

Oh, I made a mistake when I first wrote the post and edited it in github and I see that you replied to the old post. Try
model { 1 ~ bernoulli(0.2) T[0.1, 1.1]; }

@bob-carpenter
Copy link
Contributor

bob-carpenter commented Dec 18, 2018 via email

@VMatthijs
Copy link
Member

VMatthijs commented Dec 19, 2018

Right. The following does compile, on stanc2:

model { 1 ~ bernoulli(0.2) T[0, 1]; }

So the problem was merely the signature of the bounds.

I think stanc3 currently does check the existence of a cdf, but I don't think it checks the type of the cdf. I hadn't realised that the bounds can sometimes be integer and that that needs to be checked. Therefore, it was not throwing an error.

By the way, the following also compiles on stanc2, which shouldn't, so that's a bug:

model { 1 ~ bernoulli(0.2) T[0, 1.1]; }

@VMatthijs
Copy link
Member

VMatthijs commented Dec 19, 2018

This should be fixed now. Definitely was a bug.

@seantalts seantalts added this to the initial release milestone Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants