cumvar

Syntax

cumvar(X)

Arguments

X is a scalar/vector.

Details

If X is a vector, calculate the cumulative variance of X. The result is a vector of the same length as X. Null values are ignored in the calculation.

If X is a matrix, conduct the aforementioned calculation within each column of X. The result is a matrix with the same shape as X.

Examples

$ x=[2,3,4];
$ cumvar(x);
[,0.5,1]

$ m=matrix(0.15 0.08 0.03 -0.14 -0.09, 0.2 -0.12 -0.16 0.08 0.16);
$ m;

#0

#1

0.15

0.2

0.08

-0.12

0.03

-0.16

-0.14

0.08

-0.09

0.16

$ cumvar(m);

#0

#1

0.00245

0.0512

0.003633333333333

0.038933333333333

0.015266666666667

0.0288

0.01433

0.02672

Related functions: cummax, cummin, cumprod, cumPositiveStreak, cumsum, cumavg, cumstd