Lua Sandbox Stats Module

1. Functions

1.1. sum

Sum an array of numbers ignoring NaN.

Arguments

  • array (table)
  • start (number, nil) - start index in the array (if nil 1)
  • end (number, nil) - end index in the array (if nil #array)

Return

  • sum (number)
  • count (integer) - number of items summed (non NaN)

1.2. avg

Average an array of numbers ignoring NaN.

Arguments

  • array (table)
  • start (number, nil) - start index in the array (if nil 1)
  • end (number, nil) - end index in the array (if nil #array)

Return

  • avg (number)
  • count (integer) - number of items averaged (non NaN)

1.3. min

Return the minimum value in an array of numbers.

Arguments

  • array (table)
  • start (number, nil) - start index in the array (if nil 1)
  • end (number, nil) - end index in the array (if nil #array)

Return

  • min (number)
  • count (integer) - number of items compared (non NaN)

1.4. max

Return the maximum value in an array of numbers.

Arguments

  • array (table)
  • start (number, nil) - start index in the array (if nil 1)
  • end (number, nil) - end index in the array (if nil #array)

Return

  • max (number)
  • count (integer) - number of items compared (non NaN)

1.5. variance

Return the variance of an array of numbers.

Arguments

  • array (table)
  • start (number, nil) - start index in the array (if nil 1)
  • end (number, nil) - end index in the array (if nil #array)

Return

  • variance (number)
  • count (integer) - number of items in the calculation (non NaN)

1.6. sd

Return the standard deviation of an array of numbers.

Arguments

  • array (table)
  • start (number, nil) - start index in the array (if nil 1)
  • end (number, nil) - end index in the array (if nil #array)

Return

  • sd (number)
  • count (integer) - number of items in the calculation (non NaN)

1.7. ndtr

Normal ditribution function.

Arguments

  • x (number)

Return

  • a (number) - returns the area under the Gaussian probability density function, integrated from minus infinity to x

1.8. mannwhitneyu

Computes the Mann-Whitney rank test on arrays x and y.

Arguments

  • x (table)
  • y (table)
  • use_continuity (bool) - whether a continuity correction (1/2) should be taken into account (default: true)

Return

  • u (number) - Mann-Whitney U statistic, equal to min(u for x, u for y)
  • p (number) - one-sided p-value assuming a asymptotic normal distribution

Note: Use only when the number of observation in each sample is > 20 and you have 2 independent samples of ranks. Mann-Whitney U is significant if the u obtained is LESS THAN or equal to the critical value of u.

This test corrects for ties and by default uses a continuity correction. The reported p-value is for a one-sided hypothesis, to get the two-sided p-value multiply the returned p-value by 2.

source code: stats.lua

results matching ""

    No results matching ""