Skip to content

Instantly share code, notes, and snippets.

@ghalimi
Last active Sep 25, 2019
Embed
What would you like to do?
NORMDIST Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function NORMDIST(x, mean, sd, cumulative) {
// Check parameters
if (isNaN(x) || isNaN(mean) || isNaN(sd)) return '#VALUE!';
if (sd <= 0) return '#NUM!';
// Return normal distribution computed by jStat [http://jstat.org]
return (cumulative) ? jStat.normal.cdf(x, mean, sd) : jStat.normal.pdf(x, mean, sd);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment