Skip to content

Instantly share code, notes, and snippets.

@ghalimi
Last active September 25, 2019 14:07
Show Gist options
  • Save ghalimi/4476478 to your computer and use it in GitHub Desktop.
Save ghalimi/4476478 to your computer and use it in GitHub Desktop.
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