Main Content


Expected return and covariance from return time series



[ExpReturn,ExpCovariance,NumEffObs] = ewstats(RetSeries) computes estimated expected returns (ExpReturn), estimated covariance matrix (ExpCovariance), and the number of effective observations (NumEffObs). These outputs are maximum likelihood estimates which are biased.


[ExpReturn,ExpCovariance,NumEffObs] = ewstats(___,DecayFactor,WindowLength) adds optional input arguments for DecayFactor and WindowLength.


collapse all

This example shows how to compute the estimated expected returns and the estimated covariance matrix.

RetSeries = [ 0.24 0.08 
              0.15 0.13 
              0.27 0.06 
              0.14 0.13 ];

DecayFactor = 0.98;

[ExpReturn, ExpCovariance] = ewstats(RetSeries, DecayFactor)
ExpReturn = 1×2

    0.1995    0.1002

ExpCovariance = 2×2

    0.0032   -0.0017
   -0.0017    0.0010

Input Arguments

collapse all

Return series, specified the number of observations (NUMOBS) by number of assets (NASSETS) matrix of equally spaced incremental return observations. The first row is the oldest observation, and the last row is the most recent.

Data Types: double

(Optional) Controls how much less each observation is weighted than its successor, specified as a numeric value. The kth observation back in time has weight DecayFactork. DecayFactor must lie in the range: 0 < DecayFactor <= 1.

The default value of 1 is the equally weighted linear moving average model (BIS).

Data Types: double

(Optional) Number of recent observations in the computation, specified as a numeric value.

Data Types: double

Output Arguments

collapse all

Estimated expected returns, returned as a 1-by-NASSETS vector.

Estimated covariance matrix, returned as a NASSETS-by-NASSETS matrix.

The standard deviations of the asset return processes are defined as

     STDVec = sqrt(diag(ExpCovariance))

The correlation matrix is

     CorrMat = ExpCovariance./( STDVec*STDVec' )

NumEffObs is the number of effective observations where


A smaller DecayFactor or WindowLength emphasizes recent data more strongly but uses less of the available data set.


For a return series r(1),…,r(n), where (n) is the most recent observation, and w is the decay factor, the expected returns (ExpReturn) are calculated by


where the number of effective observations NumEffObs is defined as


E(r) is the weighed average of r(n),…,r(1). The unnormalized weights are w, w2, …, w(n-1). The unnormalized weights do not sum up to 1, so NumEffObs rescales the unnormalized weights. After rescaling, the normalized weights (which sum up to 1) are used for averaging. When w = 1, then NumEffObs = n, which is the number of observations. When w < 1, NumEffObs is still interpreted as the sample size, but it is less than n due to the down-weight on the observations of the remote past.


The ewstats function may give slightly different results from the RiskMetrics® approach for determining expected return and covariance from a time series. This is because ewstats calculates NumEffObs by directly summing the unnormalized weights, while RiskMetrics® uses an approximation. Additionally, RiskMetrics® assumes a mean of 0 in the return series when calculating the covariance, while ewstats uses the calculated ExpReturn output.

Version History

Introduced before R2006a