Weighted average (WAV#)

This calculates a weighted average for a series between two dates, or over a time period.A parameter N can be used to return N/A if there are any missing values in the data sample.The formula used to produce a weighted average is:

Unlike the MAV# function, which gives equal weighting to each value within the period, WAV# gives highest weighting to the most recent values.

Formats

WAV#(Expression,Start Date,End Date)

This static format calculates the weighted average for a series between two given dates. Actual dates are typed in using either the standard DD/MM/YY format or the displacement date formats.

As a date parameter one can also use YRE, HFE, QTE, MTE, WKE, LYE, BDATE, BDATEXXF

WAV#(Expression)

If you do not specify start and end dates, the defaults are the start and end dates for the display period.

WAV#(Expression,Period)

This moving format calculates the continuous weighted average for a series over a moving time period. Use the period codes to specify the period.

WAV#(Expression,Period,Parameter)

The parameter set to N can be used to return N/A if there are any missing values in the data sample.

Examples

WAV#(U:F,1/1/98,31/3/98)

This static format gives a single value: the weighted average for Ford share price for the first quarter of 1998.

WAV#(U:F)

This default static format calculates the weighted average for Ford share price over the display period.

WAV#(U:F,20D)

This moving format calculates a continuous weighted average for Ford over a 20 day period between the start and end dates for the display period.

WAV#(CACPCOREF,3Y,N)

This calculates a rolling weighted average for an Economics datatype but returns N/A when there are missing values in the data set.

You can also use the weighted average function code as an argument in the ACHV#, PCHV#, and REB# functions. For example:

PCHV#(U:F,WAV)

This calculates the percentage deviation of the current value from the weighted average over the display period.

Warning

You must use a weighted average period that is consistent with the frequency of the stored data. That is, the Period frequency you request for the function can be greater but not less than the data frequency. For example:

WAV#(UKBCJD..,30D)

A daily period is invalid for the UK unemployment series because ithe frequency of the data is monthly.

Note You can use WAV# with a maximum of 4,000 values. If you request a weighted average period that requires more than 4,000 values, an error message is displayed. To reduce the number of values, either reduce the display period or the weighted average period. These time periods should not exceed 15 years.

See also

Average functions