Helpful utility functions for basic statistical operations 😀
Made in 🇧🇩(Bangladesh) with 💖"
- Full TypeScript Support
- Average, Max, Min, Mode, Median, Harmonic Mean
- Percentile, Range
- Variance , Standard Deviation
- Corelation
To use these utility functions in your project, you can install them via npm:
npm install ts-stats
or
yarn add ts-stats
Here's an overview of the available utility functions and how to use them:
import { avg } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const average = avg(numbers);
console.log("Average:", average);
import { corelation } from "ts-stats";
const dataX = [1, 2, 3, 4, 5];
const dataY = [2, 4, 6, 8, 10];
const correlation = corelation(dataX, dataY);
console.log("Correlation:", correlation);
import { extrema } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const [min, max] = extrema(numbers);
console.log("Min:", min, "Max:", max);
import { harmonicMean } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const mean = harmonicMean(numbers);
console.log("Harmonic Mean:", mean);
import { median } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const medianValue = median(numbers);
console.log("Median:", medianValue);
import { mode } from "ts-stats";
const numbers = [1, 2, 2, 3, 4, 4, 4, 5];
const modeValue = mode(numbers);
console.log("Mode:", modeValue);
import { percentile } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const p90 = percentile(numbers, 90);
console.log("90th Percentile:", p90);
import { range } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const rangeValue = range(numbers);
console.log("Range:", rangeValue);
import { stdDev } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const deviation = stdDev(numbers);
console.log("Standard Deviation:", deviation);
import { variance } from "ts-stats";
const numbers = [1, 2, 3, 4, 5];
const varianceValue = variance(numbers);
console.log("Variance:", varianceValue);
This project is licensed under the GPL License - see the LICENSE file for details.