# Decomposing a time series with some zero values

There are many techniques to decompose a time series into trend, seasonal, and remainder components. I was wondering if these techniques can be applied without worry to time series which have some zero values. I think that the answer may be different according to the decomposition method used and to the observed ratio of zero to non zero values.

Since the question might sound too broad, I'll focus on just two decomposition methods: decomposition using a moving average and the STL procedure. I'm worried that the estimate of the seasonal component will be biased by the presence of the zero values. Intuitively, if the time series isn't too short, I'd say that the seasonal component will not be too much affected if the ratio of zero to non zero values is low. But how can I ensure that the zero values aren't too many? I'd like to know if I should aggregate the data until there are non more zero values (such as considering data by quarters instead that by month) or if I need to apply specific techniques which can handle zero values.

• Are these true zero values, or missing data? Additive seasonal-trend models should have no problem handling zero values. Jul 26, 2018 at 0:34
• They are true zero values Jul 26, 2018 at 6:38

Additive models for seasonal-trend decomposition should have no problem with zero values. With additive models

data = seasonality + trend + residual


the trend will be calculated adjust to the appropriate level, which can be near zero without any restriction.

If there were reason to believe that the composition should be multiplicative, then zero values would be problematic.

• This is being automatically flagged as low quality, probably because it is so short. At present it is more of a comment than an answer by our standards. Can you expand on it? You can also turn it into a comment. Jul 27, 2018 at 1:52
• Thank you for your answer, sfjac. Before accepting the answer, I would like to know why zero values are problematic if the time series follows a multiplicative decomposition. Is it because we can't log-transform the data? Aug 1, 2018 at 16:50
• @John M - That is one way of looking at it - typically multiplicative decomposition is actually done by log transforming and then doing an additive decomposition. Another way to think of it is if one of the components S or T goes to zero, then V is zero and the other is undetermined, as is the "residual". Aug 1, 2018 at 18:56
• I see, thank you for the explanation. Let's suppose that the time series follows a multiplicative model. Wouldn't it be helpful to add a positive constant to the time series (so that all the values become greater than zero), perform the decomposition on the transformed data and then go back to the original scale by a back-trasformation? Sep 10, 2018 at 18:20