IrregularMovingAverage

Moving average designed to handle irregularly spaced data, i.e. data where the time intervals between successive values are not the same.

Members

Functions

beta
Value beta()
beta
Value beta(Value b)

Set the discount coefficient for this moving average. It may be useful to adjust this value if, for example, the average waiting time between data points turns out to be very different from initial expectations.

predicted_value
Value predicted_value(Time t)

Calculates the predicted future value of the moving average

update
void update(Value value, Time value_time)

Generates an updated moving average with a new data point, using the specified discount coefficient. The new moving average is returned as a new struct instance, rather than mutating the internal struct data.

update_time
Time update_time()
value
Value value()

Static functions

opCall
This opCall(Value beta, Time expected_time_interval, Value first_value, Time first_value_time)

"Constructor"-style static opCall

Parameters

Time

type used to indicate the observation time of individual data values; may be any type implicitly convertible to time_t, or any integral or floating point value

Value

floating-point type used to indicate data values

The double-exponential moving average implemented here is derived from section 3 (eqs. 16-22) of Cipra, T. (2006) 'Exponential smoothing for irregular data', Applications of Mathematics 51 (6): 597-604 <http://dml.cz/handle/10338.dmlcz/134655>.

Most of the parameter names are derived from their counterparts in the aforementioned article.

Meta