Function
Static Public Summary | ||
public |
Choose k elements from a set of n elements. |
|
public |
A useful function. |
|
public |
n! is the product of all positive integers less than or equal to n. |
|
public |
The gamma function is a useful general function. |
|
public |
gammainc_lower(s: number, z: number): number The regularized lower incomplete gamma function See |
|
public |
The log-gamma function is a useful general function. |
|
public |
Averages a list of elements. |
|
public |
Finds the central most value for a list of numbers. |
|
public |
Finds the most frequent values of a list of numbers. |
|
public |
percentile(x: Array<number>, p: number): number Finds the element of a list of numbers at a certain percentile ordered smallest to largest. |
|
public |
Finds the nth largest element of a list of numbers. |
|
public |
Finds the difference between the largest and smallest values. |
|
public |
Efficiently finds the kth largest element in a array. |
|
public |
A measure that is used to quantify the amount of variation of a set of data values. |
|
public |
Efficiently appoximates ln(n!). |
|
public |
Adds a list of elements together. |
|
public |
A really useful function. |
|
public |
Computes Student's T-Test for the provided samples. If only one sample is provided, a one-sample t-test is computed on the sample mean vs x. If two samples are provided, a two-sample t-test is computed on the difference between the sample means and x. See: Student's T-Test |
|
public |
A measure that is used to quantify the amount of variation of a set of data values from their mean value. |
|
public |
The signed number of deviations an observed value is above the mean. |
Static Public
public choose(n: number, k: number): number source
import choose from 'sampson/lib/utils/choose.js'
Choose k elements from a set of n elements. See: Binomial Coefficient
public error(x: number): number source
import error from 'sampson/lib/utils/error.js'
A useful function. Gets used in the Normal distribution cdf. It's the probability of a random variable with normal distribution of mean 0 and variance 1/2 falling in the range [-x, x]. See: Error
Params:
Name | Type | Attribute | Description |
x | number | The numbers to average. |
public factorial(n: number): number source
import factorial from 'sampson/lib/utils/factorial.js'
n! is the product of all positive integers less than or equal to n. See
Params:
Name | Type | Attribute | Description |
n | number | The number. |
public gamma(n: number): number source
import gamma from 'sampson/lib/utils/gamma.js'
The gamma function is a useful general function. It's (n - 1)!. See
Params:
Name | Type | Attribute | Description |
n | number | The number. |
public gammainc_lower(s: number, z: number): number source
import gammainc_lower from 'sampson/lib/utils/gammainc.js'
The regularized lower incomplete gamma function See
public lngamma(z: number): number source
import lngamma from 'sampson/lib/utils/lngamma.js'
The log-gamma function is a useful general function. It can handle much larger numbers because it grows much slower compared to the gamma function. It's (n - 1)! and is used by the gamma function for n > 100. See
Params:
Name | Type | Attribute | Description |
z | number | The number. |
public mean(x: Array<number>): number source
import mean from 'sampson/lib/utils/mean.js'
Averages a list of elements. Uses our internal sum function. See: Mean
public median(x: Array<number>): number source
import median from 'sampson/lib/utils/median.js'
Finds the central most value for a list of numbers. If the list is even, and has no single center, the two inner-most values are averaged. Uses our internal selection function. See: Median
public mode(x: Array<number>): number source
import mode from 'sampson/lib/utils/mode.js'
Finds the most frequent values of a list of numbers. It always returns an array. The result may contain one or more values. See: Mode
public percentile(x: Array<number>, p: number): number source
import percentile from 'sampson/lib/utils/percentile.js'
Finds the element of a list of numbers at a certain percentile ordered smallest to largest. Uses the internal select function. See: List Ranking
public quantile(x: Array<number>, quantiles: Array<number>): number source
import quantile from 'sampson/lib/utils/quantile.js'
Finds the nth largest element of a list of numbers. Accepts both a single quantile and an array of quantiles. See: List Ranking
Return:
number | The computed quantiles respective to quantiles provided or NaN if x is the empty set. |
public range(x: Array<number>): number source
import range from 'sampson/lib/utils/range.js'
Finds the difference between the largest and smallest values. See: Range)
public select(x: Array<number>, k: number, begin: number, end: number): number source
import select from 'sampson/lib/utils/select.js'
Efficiently finds the kth largest element in a array. See: Selection
public std(x: Array<number>): number source
import std from 'sampson/lib/utils/std.js'
A measure that is used to quantify the amount of variation of a set of data values. See: Standard Deviation
public stirling(n: number): number source
import stirling from 'sampson/lib/utils/stirling.js'
Efficiently appoximates ln(n!). Similar to the gamma function, but can be faster and more accurate. See: Stirling's Approximation
Params:
Name | Type | Attribute | Description |
n | number | The number. |
public sum(x: Array<number>): number source
import sum from 'sampson/lib/utils/sum.js'
Adds a list of elements together. Uses the Kahan summation algorithm to compensate for floating-point error. See: Summation
public sumNthPowerDev(x: Array<number>, n: number, absolute: boolean): number source
import sumNthPowerDev from 'sampson/lib/utils/sumnthpowerdev.js'
A really useful function. Takes a set of observations and returns the sum of the difference of each observation and the mean of the set raised to the nth power. Can be used to find the absolute value of the difference for functions like MeanDeviation, or by default, the signed values for functions like Variance and SquaredMeanDeviation.
public ttest(sample: Sample, other: Sample, x: number): number source
import ttest from 'sampson/lib/statistics/ttest.js'
Computes Student's T-Test for the provided samples. If only one sample is provided, a one-sample t-test is computed on the sample mean vs x. If two samples are provided, a two-sample t-test is computed on the difference between the sample means and x. See: Student's T-Test
public variance(x: Array<number>): number source
import variance from 'sampson/lib/utils/variance.js'
A measure that is used to quantify the amount of variation of a set of data values from their mean value. See: Variance
public zscore(x: number, mu: number, std: number): number source
import zscore from 'sampson/lib/utils/zscore.js'
The signed number of deviations an observed value is above the mean. See: Standard Score