varSamp
varSamp
Introduced in: v1.1
Calculate the sample variance of a data set.
The sample variance is calculated using the formula:
其中:
- 是数据集中的每个数据点
- 是数据集的算术平均值
- 是数据集中的数据点数量
该函数假定输入数据集代表从更大总体中抽取的样本。如果您需要计算整个总体的方差(当您拥有完整数据集时),应使用 varPop。
注意
This function uses a numerically unstable algorithm. If you need numerical stability in calculations, use the varSampStable function. It works slower but provides a lower computational error.
Syntax
Aliases: VAR_SAMP
Arguments
x— The population for which you want to calculate the sample variance.(U)Int*orFloat*orDecimal*
Returned value
Returns the sample variance of the input data set x. Float64
Examples
Computing sample variance