varPop
Calculates the population variance.
Calculates the population variance.
The population variance is calculated using the formula:
$$ \frac{\Sigma{(x - \bar{x})^2}}{n} $$
Where:
- $x$ is each value in the population
- $\bar{x}$ is the population mean
- $n$ is the population size
:::note
This function uses a numerically unstable algorithm. If you need numerical stability in calculations, use the varPopStable function. It works slower but provides a lower computational error.
:::
Syntax
varPop(x)Arguments
Returned value
Returns the population variance of x. Float64
Examples
Computing population variance
DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
x UInt8,
)
ENGINE = Memory;
INSERT INTO test_data VALUES (3), (3), (3), (4), (4), (5), (5), (7), (11), (15);
SELECT
varPop(x) AS var_pop
FROM test_data;┌─var_pop─┐
│ 14.4 │
└─────────┘Introduced in version 1.1.