hafen / stlplus

Seasonal-Trend Decomposition using Loess (STL) in R
Other
64 stars 12 forks source link

Handling Missing Values #4

Open Pythagoras19 opened 7 years ago

Pythagoras19 commented 7 years ago

Hello,

I would like to know how the issue with Nan values has been handled within the code. By ignoring the missing data or simply by interpolation?

Regards,

hafen commented 7 years ago

It is doing it by interpolation (using loess), but it works quite well (when there really is a regular seasonal pattern) because it interpolates both in the seasonal and trend domains.

A good reference on exactly how it's done is in the original paper.

As an example, see the image that's in the README (reposted below). The top panel shows the original series which is missing 2 years of data. The magenta color in the subsequent panels is the imputed component values based on interpolation. As you can see, both the seasonal and trend behavior is imputed.

image