Calculates the cumulative variance of a series.
CUMVAR(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 series or table.
cumvar({20, 15, 30, 10, 25})
returns {nan, 12.5, 58.3333, 72.9167, 62.5}.
W1: integ(gnorm(1000, 1))
W2: cumvar(W1)
variance(W1) == W2[end]
The last point of CUMVAR is the overall variance of the input data.
W1: {20, 15, nan, nan, 25}
W2: cumvar(w1)
W3: cumvar(w1, "omitnan")
W4: cumvar(w1, "includenan")
W2 == {nan, 12.5, 12.5, 12.5, 25}
W3 == {nan, 12.5, 12.5, 12.5, 25}
W4 == {nan, 12.5, nan, nan, nan}
Both W2 and W3 omit the NaN values.
W4 includes the NaN values such that once an NaN is encountered, the cumulative variance remains at NaN.
W1: {20, 15, nan, nan, 25}
W2: cumvar(w1, 1)
W3: cumvar(w1, 1, "omitnan")
W4: cumvar(w1, 1, "includenan")
W2 == {0, 6.25, 6.25, 6.25, 16.6667}
W3 == {0, 6.25, 6.25, 6.25, 16.6667}
W4 == {0, 6.25, nan, nan, nan}
Same as above except dof is set to 1, normalize by 1/N.
W1: {3 + i, 4 + 2i, 2 + 3i, 2 + 4i, 8 + 5i}
W2: cumvar(w1)
W3: cumvar(w1, 1)
W2 == {nan, 1, 2, 2.5833, 8.7}
W3 == {0, 0.5, 1.3333, 1.9375, 6.9600}
The variance of a complex series is real.
CUMVAR calculates the cumulative variance of a series.
The nth value of the output series is equal to the variance of the first n points of the input series.
For dof == 0 (i.e. 1/(N-1) scaling), the first point of the result is nan.
For dof == 1 (i.e. 1/N scaling), the first point of the result is 0.
See CUMAVG for the cumulative average.