From f2d52e61809e700e993f63abdac001159bb21f2b Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Tue, 25 Feb 2020 20:08:53 +0000 Subject: [PATCH] Minor touches to models --- src/components/charts/DistPlusPlot.re | 7 ++++++- src/models/EAFunds.re | 7 ++++--- src/utility/GuesstimatorLibrary.js | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/charts/DistPlusPlot.re b/src/components/charts/DistPlusPlot.re index 4fadde2d..3a132689 100644 --- a/src/components/charts/DistPlusPlot.re +++ b/src/components/charts/DistPlusPlot.re @@ -39,7 +39,12 @@ module IntegralChart = { integral |> Distributions.Continuous.toLinear |> E.O.fmap(Distributions.Continuous.getShape); - let minX = integral |> Distributions.Continuous.T.minX; + let range = T.xTotalRange(distPlus); + let minX = + switch (T.minX(distPlus), range) { + | (Some(min), Some(range)) => Some(min -. range *. 0.001) + | _ => None + }; let maxX = integral |> Distributions.Continuous.T.maxX; let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson; { - {meanDiff: 1.1, stdDiff: 1.1}; + {meanDiff: 1.1, stdDiff: 1.08}; }; let calculateDifference = (currentValue, dateTime, currentDateTime, y: yearlyNumericDiff) => { let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; let meanDiff = Js.Math.pow_float(~base=y.meanDiff, ~exp=yearDiff); - let stdDevDiff = Js.Math.pow_float(~base=y.meanDiff, ~exp=yearDiff); + let stdDevDiff = Js.Math.pow_float(~base=y.stdDiff, ~exp=yearDiff); GuesstimatorDist.logNormal( currentValue *. meanDiff, firstYearStdDev *. stdDevDiff, @@ -163,8 +163,9 @@ module Model = { ~guesstimatorString= GuesstimatorDist.min( GlobalCatastrophe.guesstimatorString, - GuesstimatorDist.logNormal(40., 4.), + GuesstimatorDist.logNormal(20., 2.), ), + ~unit=TimeDistribution({zero: currentDateTime, unit: `years}), ~domain=RightLimited({xPoint: 100., excludingProbabilityMass: 0.3}), (), ), diff --git a/src/utility/GuesstimatorLibrary.js b/src/utility/GuesstimatorLibrary.js index cef3a65b..bbe6a493 100644 --- a/src/utility/GuesstimatorLibrary.js +++ b/src/utility/GuesstimatorLibrary.js @@ -46,7 +46,7 @@ const toPdf = (values, outputResolutionCount, min, max) => { const samples = new Samples(continuousSamples); const ratioSize$ = ratioSize(samples); - const width = ratioSize$ === 'SMALL' ? 40 : 1; + const width = ratioSize$ === 'SMALL' ? 60 : 1; const pdf = samples.toPdf({ size: outputResolutionCount, width, min, max }); continuous = pdf;