MastodonC / kixi.stats

A library of statistical distribution sampling and transducing functions
https://cljdoc.xyz/d/kixi/stats
Eclipse Public License 1.0
355 stars 17 forks source link

Truncated distribution #36

Open bombaywalla opened 4 years ago

bombaywalla commented 4 years ago

I added a truncated distribution that takes a distribution and returns another distribution that is truncated to a given range. I mostly wanted it for a truncated normal, but thought I may as well make it more general.

I wrote some tests for it. They seem to work, other than the chi-squared. I have added some comments documenting the parameters for which I get the failure. Not sure where the real problem is. There could be a problem in cdf/quantile for chi-squared. Or, it could be that I just need to restrict the range of parameters used in the test, so that the values stay within a reasonable range. If so, please let me know and I will make the changes.

Would you please take a look? Thanks

henrygarner commented 4 years ago

Transforming a distribution via truncation is a neat idea. I'll take a look at the chi-squared issue.