Replaces the contents of the result variable with the sample variance of the input vector. If the keyword divn is present, VARIANCE replaces the contents of the result variable with the population variance of the input vector.
As an alternate to divn, you can use pop, which is more mnemonic of the fact that it forces calculation of the "population variance".
Missing values, represented by "NaN" or ".", are ignored in the computation of the variance.
Usage with the LET command
You can use VARIANCE as a function in the LET command. By default, it will compute the sample variance. If you want to use it to compute the population variance, use the name VARIANCE_POP, which is only valid within a LET command.
COPY (75 60 82 95 88 79 69 74 89) grades VARIANCE divn grades variance PRINT variance
The above program produced the following result:
The next program shows the relationship between the variance and the standard deviation. Variance is the square of the standard deviation.
NORMAL 1000 50 20 data STDEV data stddev VARIANCE data variance PRINT stddev variance
The above program produced the following result on one run:
stddev: 19.977625049460396 variance: 399.10550261682744