Constructor
new Ewma(halfLife)
Computes an exponentionally-weighted moving average.
Parameters:
Name | Type | Description |
---|---|---|
halfLife |
number | About half of the estimated value will be from the last |halfLife| samples by weight. |
- Source:
Members
-
(private) alpha_ :number
-
Larger values of alpha expire historical data more slowly.
Type:
- number
- Source:
-
(private) estimate_ :number
-
Type:
- number
- Source:
-
(private) totalWeight_ :number
-
Type:
- number
- Source:
Methods
-
getEstimate() → {number}
-
- Source:
Returns:
- Type
- number
-
getTotalWeight() → {number}
-
- Source:
Returns:
- Type
- number
-
sample(weight, value)
-
Takes a sample.
Parameters:
Name Type Description weight
number value
number - Source: