Small beta error message change

This commit is contained in:
Ozzie Gooen 2022-07-05 19:48:41 -04:00 committed by GitHub
parent 7a419742ad
commit 4054f7dbff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,8 +134,10 @@ module Beta = {
let fromMeanAndStdev = (mean, stdev) => {
// https://en.wikipedia.org/wiki/Beta_distribution#Mean_and_variance
if !(0.0 < stdev && stdev <= 0.5) || !(0.0 <= mean && mean <= 1.0) {
"Beta mean must be in [0,1] and stdev must be in (1,0.5]"->Error
if !(0.0 < stdev && stdev <= 0.5) {
Error("Stdev must be in in between 0 and 0.5.")
} else if !(0.0 <= mean && mean <= 1.0) {
Error("Mean must be in between 0 and 1.0.")
} else {
let var = stdev *. stdev
let sampleSize = mean *. (1.0 -. mean) /. var -. 1.0