1.0.5 • Published 12 months ago

statcalc v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

StatCalc

StatCalc is a mathematical package for performing statistical calculations.

Installation

You can install StatCalc using npm:

npm install statcalc

Usage

// Import the statcalc module
import { mean, median, mode } from 'statcalc';


const numbers = [1, 2, 3, 4, 5, 5, 6, 6, 7, 8, 9];
console.log(mean(numbers));    // Output: 5.090909090909091
console.log(median(numbers));  // Output: 6
console.log(mode(numbers));    // Output: [5, 6]

const emptyArray = [];
console.log(mean(emptyArray)); // Throws an error: Empty array

API

mean(numbers)

Calculates the mean of an array of numbers.

  • numbers (Array): An array of numbers.
  • Returns: The mean value as a number.

median(numbers)

Calculates the median of an array of numbers.

  • numbers (Array): An array of numbers.
  • Returns: The median value as a number.

mode(numbers)

Calculates the mode of an array of numbers.

  • numbers (Array): An array of numbers.
  • Returns: An array containing the mode(s) of the input array.
1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago