Computes the binomial distribution for a given
If you want to calculate only one value for a particular use
n
and probability
where the element at the index k
corresponds to the probability that out of n
independent trials exactly k
are successful, when each of them has an individual probability
. This method returns an array of floating point numbers with their indices . See the above link for more information about the binomial distribution’s statistical properties including mean, variance etc.If you want to calculate only one value for a particular use
binomialProbabilityMass(k, n, probability)
(see example).Formula:
Parameters:
(integer) n (optional, default: 10)
(integer or float) probability (optional, default: 0.5)
Usage:
var distribution = stats.binomialDistribution(5, 0.5);
// probabilities of k = 0, 1, … 5 out of 5 coin tosses are heads
var single = stats.binomialProbabilityMass(12, 22, 0.4);
// the probability of exactly 12 out of 22 succesful events,
// each with a probability to occur of 0.4
Returns:
distribution: [ 0.03125, 0.15625, 0.3125, 0.3125, 0.15625, 0.03125 ]
single: 0.06559…
Computes the binomial cumulative distribution for a given
If you want to calculate only one value for a particular use
n
and probability
where the element at the index k
corresponds to the probability that out of n
independent trials no more than k
are successful, when each of them has an individual probability
. This method returns an array of floating point numbers with their indices .If you want to calculate only one value for a particular use
binomialCumulativeValue(k, n, probability)
(see example).Formula:
Parameters:
(integer) n (optional, default: 10)
(integer or float) probability (optional, default: 0.5)
Usage:
var distribution = stats.binomialCumulativeDistribution(5, 0.5);
// probabilities of k ≤ 0, 1, … 5 out of 5 coin tosses are heads
var single = stats.binomialCumulativeValue(12, 22, 0.4);
// the probability of no more than 12 out of 22 succesful events,
// each with a probability to occur of 0.4
Returns:
distribution: [ 0.03125, 0.1875, 0.5, 0.8125, 0.96875, 1 ]
single: 0.94489…
Computes the Chi squared distribution for a given degree of freedom ()
If you want to calculate only one value for a particular use
df
and returns an object where each property x
stores the value in steps of 0.01 starting at 0
until (with the threshhold parameter epsilon).If you want to calculate only one value for a particular use
chiSquaredProbabilityDensity(x, df)
(see example).Formula:
Parameters:
(integer or float) df (required)
Usage:
var distribution = stats.chiSquaredDistribution(3);
var single = stats.chiSquaredProbabilityDensity(4.3, 19);
Returns:
distribution: {
0.00: 0,
0.01: 0.03969…,
0.02: 0.05585…,
0.03: 0.06807…
}
single: 0.00032…
Computes the Chi squared cumulative distribution for a given degree of freedom ()
If you want to calculate only one value for a particular use
df
and returns an object where each property x
stores the value in steps of 0.01 starting at 0
until (with the threshhold parameter epsilon).If you want to calculate only one value for a particular use
chiSquaredCumulativeValue(x, df)
(see example). Be aware, that this method will compute incorrect results for very small x
due to numerical error imposed by JavaScript’s numerical precision. chiSquaredCumulativeDistribution()
will not return these values, instead start at the first correct index, e.g. at 0.04
.Formula:
Parameters:
(integer or float) df (required)
Usage:
var distribution = stats.chiSquaredCumulativeDistribution(3);
var single = stats.chiSquaredCumulativeValue(4.3, 19);
Returns:
distribution: {
0.00: 0,
0.04: 0.00128…,
0.05: 0.00318…,
0.06: 0.00429…
}
single: 0.76916…
Computes the normal distribution for a given
If you want to calculate only one value for a particular use
mean
and variance
and returns an object where each property x
stores the value in steps of 0.01 extending left and right from mean
until (with the threshhold parameter epsilon, e.g. for the default value of this will cover values within about 4.3 standard deviations from the mean).If you want to calculate only one value for a particular use
normalProbabilityDensity(x, mean, variance)
(see example).Formula:
Parameters:
(integer or float) mean (optional, default: 0)
(integer or float) variance (optional, default: 1)
Usage:
var distribution = stats.normalDistribution(0, 0.3);
var single = stats.normalProbabilityDensity(1.4, 2, 4);
Returns:
distribution: {
-2.59: 0.000010…,
-2.58: 0.000011…,
-2.57: 0.000012…,
…
0.00: 0.728365…,
…
2.57: 0.000012…,
2.58: 0.000011…,
2.59: 0.000010…
}
single: 0.19069…
Returns an object containing the values of the cumulative normal distribution for values of with in steps of . The standard normal table generated by this method can be used to calculate the probability that a normally distributed statistic is less than . The probability that a normally distributed statistic is greater than can – due to the symmetry of the function – be simply derived through . Likewise, the probability that a statistic is between (the arithmetic mean) and can be derived as . See probit to calculate values of the inverse function.
If you want to calculate only one value for a particular use
If you want to calculate only one value for a particular use
normalCumulativeValue(z)
(see example).Formula:
Usage:
var distribution = stats.normalCumulativeDistribution();
var single = stats.normalCumulativeValue(1.4);
Returns:
distribution: {
0.00: 0.5,
0.01: 0.50399…,
0.02: 0.50798…,
…
}
single: 0.91924…
Computes the Poisson distribution for a given
If you want to calculate only one value for a particular use
lambda
and returns an array of floating point numbers with their indices for such as (with the threshhold parameter epsilon). See the above link for more information about the Poisson distribution’s statistical properties including mean, variance etc.If you want to calculate only one value for a particular use
poissonProbabilityMass(k, lambda)
(see example).Formula:
Parameters:
(integer or float) lambda (optional, default: 1)
Usage:
var distribution = stats.poissonDistribution(0.3);
// probabilities that an event which happens at a rate of 0.3 per time interval
// will be observed k = 0, 1, … times in that interval
var single = stats.poissonProbabilityMass(2, 4);
Returns:
distribution: [ 0.74081…, 0.22224…, 0.03333…, 0.00333…, 0.00025…, 0.00001… ]
single: 0.14652…
Computes the cumulative Poisson distribution for a given
If you want to calculate only one value for a particular use
lambda
and returns an array of floating point numbers with their indices for such as (with the threshhold parameter epsilon).If you want to calculate only one value for a particular use
poissonCumulativeValue(k, lambda)
(see example).Formula:
Parameters:
(integer or float) lambda (optional, default: 1)
Usage:
var distribution = stats.poissonCumulativeDistribution(0.3);
// probabilities that an event which happens at a rate of 0.3 per time interval
// will be observed up to k = 0, 1, … times in that interval
var single = stats.poissonCumulativeValue(2, 4);
Returns:
distribution: [ 0.74081…, 0.96306…, 0.99640…, 0.99973…, 0.99998…, 0.99999… ]
single: 0.23810…
Computes the Student’s t-distribution for a given degree of freedom ()
If you want to calculate only one value for a particular use
df
and returns an object where each property t
stores the value in steps of 0.01 extending left and right from 0
until (with the threshhold parameter epsilon).If you want to calculate only one value for a particular use
studentsTProbabilityDensity(t, df)
(see example).Formula:
Parameters:
(integer or float) df (required)
Usage:
var distribution = stats.studentsTDistribution(12);
var single = stats.studentsTProbabilityDensity(0.7, 19);
Returns:
distribution: {
-7.00: 0.00001…,
-6.99: 0.00001…,
-6.98: 0.00001…,
…
0.00: 0.38910…,
…
6.98: 0.00001…,
6.99: 0.00001…,
7.00: 0.00001…
}
single: 0.30522…
Computes the Student’s cumulative t-distribution for a given degree of freedom ()
If you want to calculate only one value for a particular use
df
and returns an object where each property t
stores the value in steps of 0.01 extending left and right from 0
until (with the threshhold parameter epsilon).If you want to calculate only one value for a particular use
studentsTCumulativeValue(t, df)
(see example). Be aware, that this method will compute exact results only for reasonably small t
due to numerical error imposed by JavaScript’s numerical precision. This will affect in too low calculations of values for t
well beyond usual t-scores (e.g. for etc.) where the actual result would have to be very close to 1.Formula:
Parameters:
(integer or float) df (required)
Usage:
var distribution = stats.studentsTCumulativeDistribution(12);
var single = stats.studentsTCumulativeValue(0.7, 19);
Returns:
distribution: {
-6.77: 0.999990…,
-6.76: 0.999989…,
-6.75: 0.999989…,
…
0.00: 0.5,
…
6.75: 0.999989…,
6.76: 0.999989…,
6.77: 0.999990…
}
single: 0.75379…