Relational Data - Aggregate Functions - Reference - Stddevsampstable

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:04 GMT-0400 (Eastern Daylight Time))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The result is equal to the square root of varSamp. Unlike stddevSamp This function uses a numerically stable algorithm. It works slower but provides a lower computational error.

Syntax

stddevSampStable(x)

Parameters

Returned value

Square root of sample variance of x. Float64.

Example

Query:

DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
    population UInt8,
)
ENGINE = Log;

INSERT INTO test_data VALUES (3),(3),(3),(4),(4),(5),(5),(7),(11),(15);

SELECT
    stddevSampStable(population)
FROM test_data;

Result:

┌─stddevSampStable(population)─┐
│                            4 │
└──────────────────────────────┘