varSamp
varSamp
Calculate the sample variance of a data set.
Syntax
Alias: VAR_SAMP.
Parameters
Returned value
- Returns the sample variance of the input data set
x. Float64.
Implementation details
The varSamp function calculates the sample variance using the following formula:
Where:
xis each individual data point in the data set.mean(x)is the arithmetic mean of the data set.nis the number of data points in the data set.
The function assumes that the input data set represents a sample from a larger population. If you want to calculate the variance of the entire population (when you have the complete data set), you should use varPop instead.
Example
Query:
Response:
varSamp
Introduced in: v1.1
Calculate the sample variance of a data set.
The sample variance is calculated using the formula:
Where:
- is each individual data point in the data set
- is the arithmetic mean of the data set
- is the number of data points in the data set
The function assumes that the input data set represents a sample from a larger population. If you want to calculate the variance of the entire population (when you have the complete data set), you should use varPop instead.
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