help movavg


movavg -- MATA based Moving Average generator


movavg newvar =varname [if] [, lags(#) replace]

by is allowed for 1 varname.

options Description ------------------------------------------------------------------------- lags(#) Number of time periods (observations) to be considered in the window. replace Same behavior as in generate. -------------------------------------------------------------------------


movavg performs high speed Moving Average calculation using MATA base computations.

In the case of "by", efficiency gains are very high, in terms of computation speed, as a contrast of loop based algorithms as this implementations uses matrix algebra instead.


Setup . sysuse auto . sort rep78

Computes the moving average of price over a 3 period window . movavg ma3lags = price, lags(3)

Computes the moving average of price by rep78 over a 3 period window . by rep78: movavg ma3lags_by = price, lags(3)


George Vega Yon, Superindentencia de Pensiones.