Calculates the sample or population variance of a series..
VAR(series, dof, dim, "naflag")
(v, mu) = VAR(series, dof, dim, "naflag")
series |
- |
A series or array, the input series |
||||||||||||
dof |
- |
Optional. An integer, the degrees of
freedom normalization mode. For
|
||||||||||||
dim |
- |
Optional. An integer or string, the computation dimension.
|
||||||||||||
"naflag" |
- |
Optional. A string, the NA handling method.
|
A real scalar for a one column series or computation over the entire array else a 1xM real table for an M column series.
(v, mu) = VAR(s, dof, dim, "naflag") returns the variance and mean value as separate variables.
W1: 1..10
var(w1)
Returns 9.1667, the sample variance.
W1: 1..10
var(w1 + 1e7)
Returns 9.1667, same as above since the true variance is independent of the mean value.
W1: 1..10
var(w1, 1)
Returns 8.250, the population variance.
W1: ravel(1..9, 3)^2
W2: var(w1)
W2 == {{16.3333, 100.3333, 256.3333}}, the variance of each column.
W1: ravel(1..9, 3)^2
W2: var(w1, 0, 2)
W2 == {603, 927, 1323}, the variance of each row.
W1: ravel(1..9, 3)^2
W2: {var(w1, 0, "all")}
W2 == {788.5}, the sample variance of the entire array.
W1: ravel(1..9, 3)^2
(v, mu) = var(w1, 0, "all")
v == 788.5
mu == 31.6667
Returns the sample variance and mean of the entire array.
W1: {1, 10, nan, 3, 4, nan, 6}
W2: {var(w1, 0)}
W3: {var(w1, 0, "omitnan")}
W4: {var(w1, 0, "includenan")}
W2 == W3 == {11.7}, the variance of the series with NA values ignored.
W4 == nan, since NA values are included.
For a series of length N, the sample variance
where the arithmetic mean is defined as:
The population variance
VAR uses a fast, highly accurate corrected two-pass Neumaier sum algorithm that exhibits insensitivity to round-off errors.
As shown in the second example, the variance is independent of an additive mean value.
VAR returns the variance of each column or row for a multi-column series.
Set