Handling Missing Samples in an Exponential Moving Average
Summary
The document considers how to update an exponential moving average when a time interval contains no new observation, such as a second with no price update. It presents two choices: leave the EMA unchanged, or carry the previous sample forward and compute another update. Carrying the sample forward makes the EMA move toward that value over the empty interval, while holding the EMA constant avoids that decay.
The preferred choice depends on how downstream logic treats missing observations. The response favors recomputing from a carried-forward sample when the application should reflect elapsed periods, and suggests holding the last EMA when missingness should not change the application’s logic. For irregularly spaced observations, it points to inhomogeneous time-series operators and cites a reference on high-frequency finance. The document offers conceptual guidance rather than a detailed derivation or comparison, so it does not establish one universally correct convention.
Key ideas
- A missing time interval can be handled by reusing the previous EMA or carrying forward the previous sample and updating again.
- Carrying forward the sample causes the EMA to move toward that value during the empty interval.
- Holding the EMA constant may suit applications whose logic should not respond to missing observations.
- Inhomogeneous time-series operators are a possible framework for irregularly spaced data.
Tags
Full text
# How to update an exponential moving average with missing values? # How to update an exponential moving average with missing values? Say you have an Exponential Moving Average being continuously updated over a time series using 1-second-long time periods. What should happen if there is no value for the next second, e.g. there were no price updates? Should the function decay in some way since there are no new values? Is there a correct or accepted way of handling this case? ## Answer by chrisaycock (score 14, accepted) https://quant.stackexchange.com/a/582 You can either - reuse the last computed EMA, or - fill-forward the previous period's sample data and recompute the EMA. I generally prefer the second option, which should cause a decay. Only go for the first option if your application won't change its logic based on missing data. ## Answer by Tal Fishman (score 4) https://quant.stackexchange.com/a/1996 You should look into inhomogeneous time series operators. The original reference for this work is Zumbach and Muller (2001). An excellent introduction to the material can be found in An Introduction to High-Frequency Finance, starting on page 59. I also found online a book chapter from Modeling Financial Time Series with S-PLUS that includes code for the inhomogeneous EMA (section 9.2.4).
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.