Giter Club home page Giter Club logo

luasf's Introduction

LuaSF : Lua Statistics Functions

LuaSF

Lua Statistics Functions (LuaSF) is a small library which offers a clean, minimalistic but powerful API for discrete and continuous Pseudo-random variables mainly.

Usage

Add LuaSF.lua file inside your project.
Call it using require function.
It will return a table containing a set of functions.

Full API Overview

  • sumF = function (array) : Sum Array
  • avF = function (array) : Average Array
  • stvF = function(array) : (n-1) Standar Desviation
  • frecuencyF = function(array) : Frecuency Distribution
  • nomalVA = function (mu, sig) : Normal Distribution
  • normal_inv_D = function (p, mu, sig) : Normal-Inverse Gaussian Distribution (NIG) - RV
  • bernoulliVA = function (p) : Bernoulli Distribution - RV
  • unifVA = function (min,max) : Uniform Distribution - RV
  • expoVA = function (beta) : Exponential Distribution - RV
  • weibullVA = function (alpha,beta) : Weibull Distribution - RV
  • erlangVA = function(n, lambda) : Erlang Distribution - RV
  • trianVA = function(a,b,c) : Triangular Distribution - RV
  • binomialVA = function(n,p) : Binomial Distribution - RV
  • geometricVA = function(p) : Geomtric Distribution - RV
  • poissonVA = function(lamba) : Poisson Distribution - RV
  • chiSquareVA = function(n) : ChiSquare Distribution - RV
  • gamVA = function(alpha, lamba) : Gamma Distribution - RV
  • lognoRandVA = function(m, s) : Log-normal Distribution - RV

/RV: Random Variable

Sample

Experiment Twice Two Dice

--[[
--------------------------------------------
  sample
  twice two dice
--------------------------------------------
]]
local st = require("LuaStat")

local mList={}
for i=1,10000 do mList[i]=st.rand(1,6)+st.rand(1,6) end
local frecu = st.frecuencyF(mList)

-- report
for i=1, #frecu.c do
	print("Frecuency - Sum Number:", frecu.g[i], frecu.c[i])
end
--------------------------------------------

Normal Distribution for Quality Control Sample

-- Normal Distribution Probability
local a=5/100
print(st.normal_inv_D(a/2))
print(st.normal_inv_D(1-a/2))
--[[
--------------------------------------------
  Print:
 	-1.9688213737864
	1.9688213737864
--------------------------------------------
]]

Built With

Authors

See also the list of contributors who participated in this project.

License

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

luasf's People

Contributors

hubertronald avatar sharpobject avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

luasf's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.