This TypeScript module provides a set of functions for performing basic statistical operations on arrays of numbers.
To use these functions, include the module in your TypeScript project. Ensure you have TypeScript installed and configured.
Computes the average of an array of numbers.
Example:
import { average } from './stats';
console.log(average([1, 2, 3, 4, 7])); // Outputs: 3.4Computes the variance of an array of numbers.
Example:
import { variance } from './stats';
console.log(variance([1, 2, 3, 4, 7])); // Outputs: 4.24Computes the standard deviation of an array of numbers.
Example:
import { stdDev } from './stats';
console.log(stdDev([1, 2, 3, 4, 7])); // Outputs: 2.06Finds the median of an array of numbers.
Example:
import { median } from './stats';
console.log(median([1, 2, 3, 4, 7])); // Outputs: 3Finds the mode of an array of numbers.
Example:
import { mode } from './stats';
console.log(mode([1, 2, 3, 4, 7, 7, 7, 7])); // Outputs: 7Computes the range of an array of numbers.
Example:
import { range } from './stats';
console.log(range([1, 2, 3, 4, 7])); // Outputs: 6Computes the covariance of two arrays of numbers.
Example:
import { covariance } from './stats';
console.log(covariance([1, 2, 3, 4, 7], [1, 2, 3, 4, 7])); // Outputs: 4.24Contributions to improve the module are welcome. Please follow the standard GitHub pull request process to propose changes.