variance.php
Table of Contents
Functions
- variance() : float
- Computes the variance of a list of numbers.
Functions
variance()
Computes the variance of a list of numbers.
variance(array<int, int|float> $values[, bool $sample = false ]) : float
By default the population variance is returned (sum of squared deviations divided
by N). When $sample is true, the sample variance is returned instead (divided
by N - 1, Bessel's correction).
Parameters
- $values : array<int, int|float>
-
A list of numeric values (at least one for population, two for sample).
- $sample : bool = false
-
Whether to compute the sample variance (
N - 1) instead of the population one (N).
Tags
Return values
float —The variance of the values.