import mir.math.common: log; import mir.test: shouldApprox; logisticLPDF(-2.0).shouldApprox == log(0.1049936); logisticLPDF(-1.0).shouldApprox == log(0.1966119); logisticLPDF(-0.5).shouldApprox == log(0.2350037); logisticLPDF(0.0).shouldApprox == log(0.25); logisticLPDF(0.5).shouldApprox == log(0.2350037); logisticLPDF(1.0).shouldApprox == log(0.1966119); logisticLPDF(2.0).shouldApprox == log(0.1049936); // Can also provide location/scale parameters logisticLPDF(-1.0, 2.0, 3.0).shouldApprox == log(0.06553731); logisticLPDF(1.0, 2.0, 3.0).shouldApprox == log(0.08106072); logisticLPDF(4.0, 2.0, 3.0).shouldApprox == log(0.07471913);
Ditto, with location and scale parameters (by standardizing x).