var

  • var(X) calculates variance of X. In case X is a matrix, variance is calculated for each column of X. The calculated var is normalized by N-1 where N is the number of observations
  • var(X,1) normalizes by N
  • var(X,norm,dim) calculates variance with the following conditions:
    • norm = 0 (resp. 1), the normalization is done using N-1 (resp. N)
    • dim = 1, along columns
    • dim = 2, along rows

Examples

> X = [1 -8 9; 3 6 -1]#

	1    -8    9
	3     6   -1
	
> var(X)

	2    98    50

> var(X,1,2)

	48,22222
	8,222222

Resources

See also

mean | std | median