Documentation

var

Variance

Syntax

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

Arguments

X

Financial times 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 in the MATLAB documentation.

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])

then

var(f, 0, 1)

is

[12.5 24.5 18.0]

and

var(f, 0, 2)

is

[9.0; 4.0]

See Also

| | |

Was this topic helpful?