Use lognormal instead of normal
This commit is contained in:
parent
b8d0368313
commit
088a623bef
|
@ -7,4 +7,14 @@ let normal = (mean: float, std: float) =>
|
|||
}
|
||||
);
|
||||
|
||||
let logNormal = (mean: float, std: float) => {
|
||||
Js.Float.(
|
||||
{
|
||||
let nMean = toPrecisionWithPrecision(Js.Math.log10(mean), ~digits=4);
|
||||
let nStd = toPrecisionWithPrecision(std, ~digits=2);
|
||||
{j|lognormal($(nMean), $(nStd))|j};
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
let divide = (str1: string, str2: string) => {j|$(str1)/$(str2)|j};
|
|
@ -18,10 +18,7 @@ module Value = {
|
|||
| Unselected => ""
|
||||
}
|
||||
| SelectSingle(r) => r
|
||||
| FloatCdf(r) =>
|
||||
let foo: Types.distribution =
|
||||
CdfLibrary.Distribution.fromString(r, 100);
|
||||
r;
|
||||
| FloatCdf(r) => r
|
||||
| Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%"
|
||||
| DateTime(r) => r |> MomentRe.Moment.defaultFormat
|
||||
| FloatPoint(r) => r |> Js.Float.toFixed
|
||||
|
@ -41,7 +38,7 @@ module Value = {
|
|||
| SelectSingle(r) => r |> ReasonReact.string
|
||||
| FloatCdf(r) =>
|
||||
let cdf: Types.distribution =
|
||||
CdfLibrary.Distribution.fromString(r, 100);
|
||||
CdfLibrary.Distribution.fromString(r, 1000);
|
||||
<>
|
||||
<ForetoldComponents.CdfChart__Large
|
||||
cdf={Types.toComponentsDist(cdf)}
|
||||
|
|
|
@ -78,7 +78,10 @@ module Model = {
|
|||
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);
|
||||
FloatCdf.normal(currentValue *. meanDiff, firstYearStdDev *. stdDevDiff);
|
||||
FloatCdf.logNormal(
|
||||
currentValue *. meanDiff,
|
||||
firstYearStdDev *. stdDevDiff,
|
||||
);
|
||||
};
|
||||
|
||||
let rec currentValue = (group: group, output) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user