Minor changes

This commit is contained in:
Ozzie Gooen 2020-02-15 11:39:37 +00:00
parent 4eb4247848
commit 5bd66be29e
4 changed files with 18 additions and 5 deletions

View File

@ -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};
}
);

View File

@ -58,7 +58,14 @@ module Value = {
| TimeLimitedDomainCdfLazy(r) =>
let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000));
let cdf = timeLimited.limitedDomainCdf.distribution;
<> <Chart height=100 data={cdf |> Types.toJs} /> </>;
<>
<Chart height=100 data={cdf |> Types.toJs} />
<Chart
height=100
data={cdf |> CdfLibrary.Distribution.toPdf |> Types.toJs}
/>
{FloatCdf.logNormal(50., 20.) |> ReasonReact.string}
</>;
| TimeLimitedDomainCdf(r) =>
let cdf: Types.distribution = r.limitedDomainCdf.distribution;
<> <Chart height=100 data={cdf |> Types.toJs} /> </>;

View File

@ -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);
};
};
};

View File

@ -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.),
);