A mixin object containing commonly used statistical methods.
- Source:
Methods
(method) average(arr) → {number}
Calculates the average value of an array.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<number> | The array of numbers. |
- Source:
Returns:
The average value.
- Type
- number
(method) calcTrendLine(arr, timeField, valueField) → {Object|null}
Calculates the trendline of an array of data points.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | The array of data points. |
timeField |
string | The field representing the time in each data point. |
valueField |
string | The field representing the value in each data point. |
- Source:
Returns:
- The trendline object containing the slope, intercept, and trendline points, or null if the array has less than 2 elements.
- Type
- Object | null
(method) derivative(s)
Calculates the derivative of a series.
Parameters:
Name | Type | Description |
---|---|---|
s |
array | The series to calculate the derivative for. Contains objects with x and y properties. |
- Source:
(method) median(arr) → {number}
Calculates the median value of an array.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | The input array. |
- Source:
Returns:
The median value.
- Type
- number
(method) movingAverage()
- Source:
(method) q1(arr) → {number}
Calculates the q1 value of an array.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | The input array. |
- Source:
Returns:
The q1 value.
- Type
- number
(method) q3(arr) → {number}
Calculates the q3 value of an array.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array | The input array. |
- Source:
Returns:
The q3 value.
- Type
- number
(method) standardDeviation(arr, mean) → {number}
Calculates the standard deviation of an array of numbers.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<number> | The array of numbers. |
mean |
number | The mean value of the array. |
- Source:
Returns:
The standard deviation.
- Type
- number
(method) statistics(numbers) → {Object}
Calculates various statistics for an array of numbers.
Parameters:
Name | Type | Description |
---|---|---|
numbers |
Array.<number> | The array of numbers. |
- Source:
Returns:
- An object containing the calculated statistics.
- Type
- Object