Average function library
Joule math functions
Objective
Averages are essential for summarising trends and smoothing fluctuations in datasets. This section covers three common types of averages:
Exponential Moving Average (EMA) This method emphasises recent data points, making it responsive to changes, particularly in financial applications.
Weighted Moving Average This average assigns different weights to data points, allowing for a focus on more important observations.
Simple Moving Average (SMA) The SMA calculates the unweighted mean of a fixed number of previous data points and is often used to identify trends over time.
Each type of average offers unique insights, making them valuable tools in data analysis.
Functions
Following is a list of the average functions which can be leverage through Joule.
Exponential Moving Average
An exponential moving average (EMA), also known as an exponentially weighted moving average (EWMA),[5] is a first-order infinite impulse response filter that applies weighting factors which decrease exponentially. The weighting for each older datum decreases exponentially, never reaching zero. This formulation is according to Hunter (1986) [wikipedia].
Attribute | Description | Data Type | Required |
---|---|---|---|
fields | Fields to calculated from the event | String[] | |
event history | Number of rolling events to stored and used for the calculation | Integer | |
assign prefix | Prefix to use for the result assignment. This is used to allow the same function to be used multiple times. If this is not provided the function postfix will be applied e.g. ask_EMA | String Default: Function postfix |
Weighted Moving Average
A weighted average is an average that has multiplying factors to give different weights to data at different positions in the sample window. Mathematically, the weighted moving average is the convolution of the data with a fixed weighting function [wikipedia].
Simple Moving Average
Last updated