var

Variance

var is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Syntax

y = var(X)
y = var(X,1)
y = var(X,W)
y = var(X,W,DIM)

Arguments

X

Financial time series object.

W

Weight vector used in calculating variance.

DIM

Dimension of X used in calculating variance.

Description

var supports financial time series objects based on the MATLAB® var function. See var.

y = var(X), if X is a financial time series object and returns the variance of each series.

var normalizes y by N1 if N > 1, where N is the sample size. This is an unbiased estimator of the variance of the population from which X is drawn, as long as X consists of independent, identically distributed samples. For N = 1, y is normalized by N.

y = var(X,1) normalizes by N and produces the second moment of the sample about its mean. var(X, 0) is the same as var(X).

y = var(X,W) computes the variance using the weight vector W. The length of W must equal the length of the dimension over which var operates, and its elements must be nonnegative. var normalizes W to sum to 1. Use a value of 0 for W to use the default normalization by N1, or use a value of 1 to use N.

y = var(X,W,DIM) takes the variance along the dimension DIM of X.

Examples

The variance is the square of the standard deviation. Consider if

 f = fints((today:today+1)', [4 -2 1; 9  5 7])
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints (line 165) 
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/display (line 66) 
 
f = 
 
    desc:  (none)
    freq:  Unknown (0)

    'dates:  (2)'    'series1:  (2)'    'series2:  (2)'    'series3:  (2)'
    '02-Oct-2017'    [            4]    [           -2]    [            1]
    '03-Oct-2017'    [            9]    [            5]    [            7]

then

var(f, 0, 1)

is

Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/var (line 49) 
[12.5 24.5 18.0]

and

var(f, 0, 2)

is

Warning: FINTS will be removed in a future release. Use TIMETABLE instead. 
> In fints/var (line 49) 
[9.0; 4.0]

See Also

| | |

Introduced before R2006a