rethinkpriorities / squigglepy

Squiggle programming language for intuitive probabilistic estimation features in Python
MIT License
65 stars 8 forks source link

normal distributions cannot have mu > sigma #2

Closed joel-becker closed 1 year ago

joel-becker commented 1 year ago

example:

>>> sq.norm(3,1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/joel/Library/Python/3.9/lib/python/site-packages/squigglepy/distributions.py", line 635, in norm
    return NormalDistribution(x=x, y=y, credibility=credibility, mean=mean, sd=sd,
  File "/Users/joel/Library/Python/3.9/lib/python/site-packages/squigglepy/distributions.py", line 571, in __init__
    raise ValueError('`high value` cannot be lower than `low value`')
ValueError: `high value` cannot be lower than `low value`
joel-becker commented 1 year ago

ah, sorry, looks like this produces a distribution defined by its interval. was confused by difference from squiggle!

peterhurford commented 1 year ago

@joel-becker Oh I thought the squiggle default was that it was defined by interval by default? Looks like I'm wrong. I could switch the defaults if that would be better / less confusing for people? My guess though is that the typical person reasons better with regard to a 90% CI from X to Y than with regard to defining mean and SD.

Note that sq.norm(mean=3, sd=1) works to define by mean / sd.