Skip to content

Helpful utility functions for basic statistical operations

License

Notifications You must be signed in to change notification settings

TriptoAfsin/ts-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ts-stats

Helpful utility functions for basic statistical operations 😀

Logo

Made in 🇧🇩(Bangladesh) with 💖"

Features -

  1. Full TypeScript Support
  2. Average, Max, Min, Mode, Median, Harmonic Mean
  3. Percentile, Range
  4. Variance , Standard Deviation
  5. Corelation

Installation

To use these utility functions in your project, you can install them via npm:

npm install ts-stats

or

yarn add ts-stats

Usage

Here's an overview of the available utility functions and how to use them:

Average (avg)

import { avg } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const average = avg(numbers);
console.log("Average:", average);

Correlation (corelation)

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);

Extrema (extrema)

import { extrema } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const [min, max] = extrema(numbers);
console.log("Min:", min, "Max:", max);

Harmonic Mean (harmonicMean)

import { harmonicMean } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const mean = harmonicMean(numbers);
console.log("Harmonic Mean:", mean);

Median (median)

import { median } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const medianValue = median(numbers);
console.log("Median:", medianValue);

Mode (mode)

import { mode } from "ts-stats";

const numbers = [1, 2, 2, 3, 4, 4, 4, 5];
const modeValue = mode(numbers);
console.log("Mode:", modeValue);

Percentile (percentile)

import { percentile } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const p90 = percentile(numbers, 90);
console.log("90th Percentile:", p90);

Range (range)

import { range } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const rangeValue = range(numbers);
console.log("Range:", rangeValue);

Standard Deviation (stdDev)

import { stdDev } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const deviation = stdDev(numbers);
console.log("Standard Deviation:", deviation);

Variance (variance)

import { variance } from "ts-stats";

const numbers = [1, 2, 3, 4, 5];
const varianceValue = variance(numbers);
console.log("Variance:", varianceValue);

License

This project is licensed under the GPL License - see the LICENSE file for details.

About

Helpful utility functions for basic statistical operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published