FloatCdf -> GuesstimatorDist

This commit is contained in:
Ozzie Gooen 2020-02-16 12:27:44 +00:00
parent d71d157741
commit c6727c40a5
4 changed files with 10 additions and 6 deletions

View File

@ -27,7 +27,7 @@ type otherSettings = {currentYear: int};
let sharesOutstanding = (price, marketCap) => let sharesOutstanding = (price, marketCap) =>
switch (price, marketCap) { switch (price, marketCap) {
| (Some(price), Some(marketCap)) => | (Some(price), Some(marketCap)) =>
Some(FloatCdf.divide(marketCap, price)) Some(GuesstimatorDist.divide(marketCap, price))
| _ => None | _ => None
}; };
@ -42,11 +42,15 @@ let rec run =
| (SHARE_PRICE, year, Some(price), _) when year > 2019 && year < 2030 => | (SHARE_PRICE, year, Some(price), _) when year > 2019 && year < 2030 =>
let diffYears = year - otherSettings.currentYear; let diffYears = year - otherSettings.currentYear;
let diffPerYear = 0.1; let diffPerYear = 0.1;
Some(FloatCdf.normal(price, float_of_int(diffYears) *. diffPerYear)); Some(
GuesstimatorDist.normal(price, float_of_int(diffYears) *. diffPerYear),
);
| (MARKET_CAP, year, _, Some(price)) when year > 2019 && year < 2030 => | (MARKET_CAP, year, _, Some(price)) when year > 2019 && year < 2030 =>
let diffYears = year - otherSettings.currentYear; let diffYears = year - otherSettings.currentYear;
let diffPerYear = 0.1; let diffPerYear = 0.1;
Some(FloatCdf.normal(price, float_of_int(diffYears) *. diffPerYear)); Some(
GuesstimatorDist.normal(price, float_of_int(diffYears) *. diffPerYear),
);
| (SHARES_OUTSTANDING, year, _, _) when year > 2019 && year < 2030 => | (SHARES_OUTSTANDING, year, _, _) when year > 2019 && year < 2030 =>
let price = run(company, year, SHARE_PRICE, otherSettings); let price = run(company, year, SHARE_PRICE, otherSettings);
let marketCap = run(company, year, MARKET_CAP, otherSettings); let marketCap = run(company, year, MARKET_CAP, otherSettings);

View File

@ -78,7 +78,7 @@ module Model = {
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.meanDiff, ~exp=yearDiff);
FloatCdf.logNormal( GuesstimatorDist.logNormal(
currentValue *. meanDiff, currentValue *. meanDiff,
firstYearStdDev *. stdDevDiff, firstYearStdDev *. stdDevDiff,
); );

View File

@ -1,9 +1,9 @@
// ~generationSource=GuesstimatorString(,
module Model = { module Model = {
let make = (currentDateTime: MomentRe.Moment.t) => { let make = (currentDateTime: MomentRe.Moment.t) => {
let genericDistribution = let genericDistribution =
GenericDistribution.make( GenericDistribution.make(
~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), ~generationSource=
GuesstimatorString(GuesstimatorDist.logNormal(20., 3.)),
~probabilityType=Cdf, ~probabilityType=Cdf,
~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}), ~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}),
~unit=Time({zero: currentDateTime, unit: `years}), ~unit=Time({zero: currentDateTime, unit: `years}),