본문으로 바로가기
본문으로 바로가기

varSampStable

varSampStable

도입 버전: v1.1

데이터 집합의 표본 분산(sample variance)을 계산합니다. varSamp와 달리 수치적으로 안정적인 알고리즘을 사용합니다. 속도는 느리지만 계산 오차가 더 낮습니다.

표본 분산은 varSamp와 동일한 공식으로 계산됩니다:

Σ(xxˉ)2n1\frac{\Sigma{(x - \bar{x})^2}}{n-1}

Where:

  • xx is each individual data point in the data set
  • xˉ\bar{x} is the arithmetic mean of the data set
  • nn is the number of data points in the data set

Syntax

varSampStable(x)

Arguments

  • x — The population for which you want to calculate the sample variance. (U)Int* or Float* or Decimal*

Returned value

Returns the sample variance of the input data set. Float64

Examples

Computing stable sample variance

DROP TABLE IF EXISTS test_data;
CREATE TABLE test_data
(
    x Float64
)
ENGINE = Memory;

INSERT INTO test_data VALUES (10.5), (12.3), (9.8), (11.2), (10.7);

SELECT round(varSampStable(x),3) AS var_samp_stable FROM test_data;
┌─var_samp_stable─┐
│           0.865 │
└─────────────────┘