variance(list)

Overview

The variance function calculates the sample variance of a given list of numbers. Variance is a statistical measurement of the spread between numbers in a dataset.

Parameters

Parameter Name Type Description Required Default Value
list table A list of numerical values for which the variance will be calculated. The list must contain at least two numerical values. Yes N/A

Returns

Type Description Possible Values
number The sample variance of the elements in the list. The return value will be a floating-point number. Any numerical value

Constraints

Example Use

local myList = {1, 2, 3, 4, 5}

-- The sample variance will be 2.5
local result = StatBook.variance(myList)
print(result)