JSPM

benford-analysis

1.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q22623F
  • License MIT

Package Exports

  • benford-analysis
  • benford-analysis/dist/benford-analysis.esm.js
  • benford-analysis/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (benford-analysis) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

benford-analysis

A lib to analisys datasets by newcomb-benford's law

Instalation

yarn add benford-analysis

Usage

import {
  readCsv,
  separateNumberByFirstDigit,
  getDeviationByFirstDigit,
  getBenfordFirstDigitExpected,
} from 'benford-analisys';

readCsv

You can read files and receive a array with the function

props:

  • csvPath: string

it expect receive the path where you save the upload file, check on example

separateNumberByFirstDigit

You can send an array from a selected column, remember to remove the head or return only number

props:

  • array: Array<number>

This function return an object with the digit d1, d2, d3,..., d9 contains percent and total numbers analized to each digit.

Check on example

getDeviationByFirstDigit

You can define a d number, it to refer the digit. And define a percent about that digit d.

props:

  • d: number
  • percent: number

It return the digit d, expect percent, percent and the deviation

Check on example

getBenfordFirstDigitExpected

It return the expected percent about digits from 1 to 9

Check on example

getDefaultDeviation

It return the default deviation of a array of numbers

Check on example