Lua Statistics Functions (LuaSF) is a small library which offers a clean, minimalistic but powerful API for discrete and continuous Pseudo-random variables mainly.
Add LuaSF.lua file inside your project.
Call it using require function.
It will return a table containing a set of functions.
- 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
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
--------------------------------------------
]]
- Visual Studio Code - The web framework used
- Hubert Ronald - Initial work - HubertRonald
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details