From 5bd66be29eefa943380d4b258f8b27c67ea88bfe Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 15 Feb 2020 11:39:37 +0000 Subject: [PATCH] Minor changes --- src/lib/FloatCdf.re | 2 +- src/lib/Prop.re | 9 ++++++++- src/models/EAFunds.re | 10 ++++++++-- src/models/GlobalCatastrophe.re | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/lib/FloatCdf.re b/src/lib/FloatCdf.re index f13e112b..dea45fb4 100644 --- a/src/lib/FloatCdf.re +++ b/src/lib/FloatCdf.re @@ -11,7 +11,7 @@ let logNormal = (mean: float, std: float) => { Js.Float.( { let nMean = toPrecisionWithPrecision(Js.Math.log10(mean), ~digits=4); - let nStd = toPrecisionWithPrecision(std, ~digits=2); + let nStd = toPrecisionWithPrecision(Js.Math.log10(std), ~digits=2); {j|lognormal($(nMean), $(nStd))|j}; } ); diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 14131b60..1eba0bd3 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -58,7 +58,14 @@ module Value = { | TimeLimitedDomainCdfLazy(r) => let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); let cdf = timeLimited.limitedDomainCdf.distribution; - <> Types.toJs} /> ; + <> + Types.toJs} /> + CdfLibrary.Distribution.toPdf |> Types.toJs} + /> + {FloatCdf.logNormal(50., 20.) |> ReasonReact.string} + ; | TimeLimitedDomainCdf(r) => let cdf: Types.distribution = r.limitedDomainCdf.distribution; <> Types.toJs} /> ; diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 6d6f03b9..9a43ca98 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -122,8 +122,14 @@ module Model = { ), ) | CHANCE_OF_EXISTENCE => - let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; - Prop.Value.Probability((100. -. yearDiff) /. 100.); + let lazyDistribution = r => + TimeLimitedDomainCdf.make( + ~timeVector={zero: currentDateTime, unit: `years}, + ~distribution=r(FloatCdf.logNormal(10., 2.)), + ~probabilityAtMaxX=0.7, + ~maxX=`x(200.), + ); + Prop.Value.TimeLimitedDomainCdfLazy(lazyDistribution); }; }; }; diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 5de10984..ddd9c196 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -3,7 +3,7 @@ module Model = { let lazyDistribution = r => TimeLimitedDomainCdf.make( ~timeVector={zero: currentDateTime, unit: `years}, - ~distribution=r("normal(50,30)"), + ~distribution=r(FloatCdf.logNormal(20., 3.)), ~probabilityAtMaxX=0.7, ~maxX=`x(200.), );