rethinkpriorities / squigglepy

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

"From ... to" method for creating beta distribution #9

Open erwald opened 1 year ago

erwald commented 1 year ago

Currently you can create normal and lognormal distributions using x, y, and credibility parameters, e.g.:

def norm(x=None, y=None, credibility=90, mean=None, sd=None,
         lclip=None, rclip=None):

but the beta distribution initializer only takes alpha/beta values:

def beta(a, b):

It might be nice to also have the previous interface available for beta, like here.

peterhurford commented 1 year ago

I would like to see https://nunosempere.com/blog/2023/03/15/fit-beta/ implemented in squigglepy as an additional interface to beta. I'll have to think about how to best handle the important trade-offs you mentioned. Adding lclip and rclip sound reasonable too.

NunoSempere commented 1 year ago

You can find an embryonic implementation of this in this pull request. Embryonic because it works in python, but the glue code for integrating it into Squigglepy is missing. Also see more details in the README.md in the pull request.