Merge pull request #388 from quantified-uncertainty/issue387

Input validation for cauchy
This commit is contained in:
Sam Nolan 2022-04-26 17:09:28 -04:00 committed by GitHub
commit 1ef766a6c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,9 +86,10 @@ module Exponential = {
module Cauchy = { module Cauchy = {
type t = cauchy type t = cauchy
let make = (local, scale): result<symbolicDist, string> => Ok( let make = (local, scale): result<symbolicDist, string> =>
#Cauchy({local: local, scale: scale}), scale > 0.0
) ? Ok(#Cauchy({local: local, scale: scale}))
: Error("Cauchy distribution scale parameter must larger than 0.")
let pdf = (x, t: t) => Jstat.Cauchy.pdf(x, t.local, t.scale) let pdf = (x, t: t) => Jstat.Cauchy.pdf(x, t.local, t.scale)
let cdf = (x, t: t) => Jstat.Cauchy.cdf(x, t.local, t.scale) let cdf = (x, t: t) => Jstat.Cauchy.cdf(x, t.local, t.scale)
let inv = (p, t: t) => Jstat.Cauchy.inv(p, t.local, t.scale) let inv = (p, t: t) => Jstat.Cauchy.inv(p, t.local, t.scale)