Main Content

var

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

Description

example

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

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

example

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

example

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.

example

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

Examples

collapse all

  1. 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]
    
  2. Then it follows:

    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]

Input Arguments

collapse all

Financial time series object, specified as a fints object.

Data Types: object

Weight vector used in calculating variance, specified as a vector.

Data Types: double

Dimension of X used in calculating variance, specified as a scalar numeric.

Data Types: double

Output Arguments

collapse all

Variance of each series, returned as a vector.

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.

Version History

Introduced before R2006a

See Also

| | |