*! version 1.0.0 23jun2013

Title

meanrets -- Calculates the expected simple return of a series of financial returns.

Syntax

meanrets varlist [if] [in]
[,options]

simplereturn if simplereturn is specified then varlist is expected to be a list of simple returns. If simplereturn is not specified,
varlist is expected to be a list of continuously compounded returns.

weightvar(varname) if this option is specified, then the variable varname will be used as the specific weights for each observations, which
will be used to compute the expected returns of the variables specified in varlist.

leweight(#) indicates the lamda value to be used to calculate weights for all observations according to the exponentially
weighted moving average (EWMA) method. The values for lamda must be greater than 0 and less than 1. (1-lamda) will be the initial weight for the
more recent observation, while the lamda value will be exponentially assigned to all other observations. The weights will decay
exponentially for old observations, so the most recent observations will have more weight for the calculation of the expected return.
See Alexander(2008) for details of the EWMA method. If the options weightvar(varname) and leweight(#) are not used, then equal weights will be used for each observation.

casewise if casewise is specified then observations with at least one missing value will be deleted (casewise deletion).
If casewise is not specified, then the missing values will be dropped variable by variable (not casewise deletion).

Description

meanrets calculates the expected simple return given a set of financial instrument or returns specified in
varlist. The varlist is expected to be list of continuously compounded returns. If the option simplereturn is specified, then the
varlist must be simple returns. The expected mean return can be calculated assigning weights for each period/observation.
With the leweight(#) option, weights for each period are generated according to the EWMA method, and these weights are used
to calculate the expected returns. If the weightvar(varname) is used, then the an existing variable can be used to weight
each period/observation and then estimate the expected mean return.
When weight options are not used, the expected simple return is calculated as the geometric return of the simple historical returns.

Remarks

Check the "Also See" Menu for related commands.
If the leweight(#) and the weightvar(varname) options are specified, the command will ONLY consider the leweight option.

Examples

Collect online monthly stock data (adjusted prices) from Yahoo Finance with the user command returnsyh. This command also calculates simple and continuous compounded returns:

. returnsyh AAPL MSFT GE, fm(1) fd(1) fy(2012) lm(12) ld(31) ly(2015) frequency(m) price(adjclose)

Calculates the expected simple returns from continuously compounded (cc) return variables:

. meanrets r_AAPL r_MSFT r_GE

Calculates the expected simple returns from simple return variables:

. meanrets R_AAPL R_MSFT R_GE, simplereturn

Calculates the expected simple returns from cc return variables, and using the exponentially weighted moving average method with a lamda=0.94:

. meanrets r_AAPL r_MSFT r_GE, leweight(0.94)

The weights for each observation according to the EWMA method were stored in the r(W) matrix. The weights are adjusted so that the sum of all weights must be equal to one.

. matrix list r(W)

Calculates the expected simple returns from cc return variables. An existing variable is used to weight each observation to compute a weighted average:

. meanrets r_AAPL r_MSFT r_GE, weightvar(vol_MSFT)

Stored results

meanrets saves results in r() in the following scalars, matrices/vectors:

Scalars

r(N): number of observations used for computations

r(numvar): number of variables or return series used

r(maxret): maximum expected return of the series

r(minret): minimum expected return of the series

Matrices

r(meanrets): (n x 1) vector of expected simple returns for each return series

r(W): (n x 1) vector of weights used to compute the expected simple returns

References:

Alexander, Carol (2008): Moving Average Models for Volatility and Correlation, and Covariance Matrices. Handbook of Finance. III:5:62.

Author

Carlos Alberto Dorantes, Tecnológico de Monterrey, Querétaro Campus, Querétaro, México.
Email: cdorante@itesm.mx