cov
Covariance matrix for financial time series object
cov
is not recommended. Use timetable
instead. For more information, see Convert Financial Time Series Objects fints to Timetables.
Description
cov(
returns a variance or covariance
matrix. X
)
If X
is a financial time series object with one series,
cov(X)
returns the variance. For a financial time series object
containing multiple series, where each row is an observation, and each series a
variable, cov(X)
is the covariance matrix.
diag(cov(X))
is a vector of variances for each series and
sqrt(diag(cov(X)))
is a vector of standard deviations.
cov(X)
normalizes by (N
-1
) if N
> 1
, where
N
is the number of observations. This makes
cov(X)
the best unbiased estimate of the covariance matrix if
the observations are from a normal distribution. For N
=
1
, cov
normalizes by
N
.
cov
for financial time series objects is based on the
MATLAB®
cov
function. See cov
.
cov(
normalizes by
X
,1)N
and produces the second moment matrix of the observations
about their mean. cov(X, Y, 0)
is the same as cov(X,
Y)
and cov(X, 0)
is the same as
cov(X)
. The mean is removed from each column before
calculating the result.
cov(
normalizes
by X
,Y
)N
and produces the second moment of the sample about its mean.
var(X, 0)
is the same as var(X)
.
cov(X,Y)
normalizes by (N
-1
) if N
> 1
, where
N
is the number of observations. This makes
cov(X,Y)
the best unbiased estimate of the covariance matrix
if the observations are from a normal distribution. For N
=
1
, cov
normalizes by N
.
cov(X, Y)
, where X
and
Y
are financial time series objects with the same number of
elements, is equivalent to cov([X(:) Y(:)])
.
Examples
Input Arguments
Version History
Introduced before R2006a