Relational Data - Aggregate Functions - Reference - Varpopstable

From FojiSoft Docs
Revision as of 18:44, 28 August 2024 by Chris.Hansen (talk | contribs) (Import ClickHouse Docs: Wed Aug 28 2024 14:44:11 GMT-0400 (Eastern Daylight Time))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

varPopStable

Returns the population variance. Unlike varPop, this function uses a numerically stable algorithm. It works slower but provides a lower computational error.

Syntax

varPopStable(x)

Alias: VAR_POP_STABLE.

Parameters

Returned value

  • Returns the population variance of x. Float64.

Example

Query:

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
    varPopStable(x) AS var_pop_stable
FROM test_data;

Result:

┌─var_pop_stable─┐
│           14.4 │
└────────────────┘