Compute the variance of an array along an axis.
Numeric.stat.variance(values, freedom = 0, invalid = false, level)Measures the spread of the values around their mean.
- Parameters:
values: Vector or matrix of input valuesfreedom: Degrees of freedom correction appliedinvalid: When true skips NaN entrieslevel: Axis along which the variance is computed
- Returns: Variance matching the requested axis
- NumPy: Covers
np.var,np.nanvar,ndarray.varthrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const value = Numeric.stat.variance([1, 2, 3])
console.log(value)
// 0.6666666666666666import Numeric from '@neabyte/numerix'
const value = Numeric.stat.variance([1, 2, 3], 1)
console.log(value)
// 1import Numeric from '@neabyte/numerix'
const value = Numeric.stat.variance([4, 4, 4])
console.log(value)
// 0import Numeric from '@neabyte/numerix'
const values = Numeric.stat.variance([[1, 2], [3, 4]], 0, false, 0)
console.log(values)
// [1,1]