| Statistics Toolbox | ![]() |
Syntax
y = var(X) y = var(X,1) y = var(X,w)
Description
computes the variance of the data in X. For vectors, var(x) is the variance of the elements in y = var(X)
x. For matrices, var(X) is a row vector containing the variance of each column of X.
normalizes by n-1 where n is the sequence length. For normally distributed data, this makes y = var(x)
var(x) the minimum variance unbiased estimator MVUE of
2 (the second parameter).
normalizes by n and yields the second moment of the sample data about its mean (moment of inertia).y = var(x,1)
computes the variance using the vector of positive weights y = var(X,w)
w. The number of elements in w must equal the number of rows in the matrix X. For vector x, w and x must match in length.
var supports both common definitions of variance. Let SS be the sum of
the squared deviations of the elements of a vector x from their mean. Then, var(x) = SS/(n-1) is the MVUE, and var(x,1) = SS/n is the maximum likelihood estimator (MLE) of
2.
Examples
x = [-1 1];
w = [1 3];
v1 = var(x)
v1 =
2
v2 = var(x,1)
v2 =
1
v3 = var(x,w)
v3 =
0.7500
| unifstat | weibcdf | ![]() |