Minor touches to models

This commit is contained in:
Ozzie Gooen 2020-02-25 20:08:53 +00:00
parent ddd0bc0820
commit f2d52e6180
3 changed files with 11 additions and 5 deletions

View File

@ -39,7 +39,12 @@ module IntegralChart = {
integral integral
|> Distributions.Continuous.toLinear |> Distributions.Continuous.toLinear
|> E.O.fmap(Distributions.Continuous.getShape); |> 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 maxX = integral |> Distributions.Continuous.T.maxX;
let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson; let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson;
<DistributionPlot <DistributionPlot

View File

@ -70,14 +70,14 @@ module Model = {
}; };
let yearlyMeanGrowthRateIfNotClosed = (group: group): yearlyNumericDiff => { let yearlyMeanGrowthRateIfNotClosed = (group: group): yearlyNumericDiff => {
{meanDiff: 1.1, stdDiff: 1.1}; {meanDiff: 1.1, stdDiff: 1.08};
}; };
let calculateDifference = let calculateDifference =
(currentValue, dateTime, currentDateTime, y: yearlyNumericDiff) => { (currentValue, dateTime, currentDateTime, y: yearlyNumericDiff) => {
let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.;
let meanDiff = Js.Math.pow_float(~base=y.meanDiff, ~exp=yearDiff); 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( GuesstimatorDist.logNormal(
currentValue *. meanDiff, currentValue *. meanDiff,
firstYearStdDev *. stdDevDiff, firstYearStdDev *. stdDevDiff,
@ -163,8 +163,9 @@ module Model = {
~guesstimatorString= ~guesstimatorString=
GuesstimatorDist.min( GuesstimatorDist.min(
GlobalCatastrophe.guesstimatorString, GlobalCatastrophe.guesstimatorString,
GuesstimatorDist.logNormal(40., 4.), GuesstimatorDist.logNormal(20., 2.),
), ),
~unit=TimeDistribution({zero: currentDateTime, unit: `years}),
~domain=RightLimited({xPoint: 100., excludingProbabilityMass: 0.3}), ~domain=RightLimited({xPoint: 100., excludingProbabilityMass: 0.3}),
(), (),
), ),

View File

@ -46,7 +46,7 @@ const toPdf = (values, outputResolutionCount, min, max) => {
const samples = new Samples(continuousSamples); const samples = new Samples(continuousSamples);
const ratioSize$ = ratioSize(samples); 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 }); const pdf = samples.toPdf({ size: outputResolutionCount, width, min, max });
continuous = pdf; continuous = pdf;