Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I am trying to detect anomalous values in a time series of climatic data with some missing observations. Searching the web I found many available approaches. Of those, stl decomposition seems appealing, in the sense of removing trend and seasonal components and studying the remainder. Reading http://cs.wellesley.edu/~cs315/Papers/stl%20statistical%20model.pdf , stl appears to be flexible in determining the settings for assigning variability, unaffected by outliers and possible to apply despite missing values. However, trying to apply it in R, with four years of observations and defining all the parameters according to http://stat.ethz.ch/R-manual/R-patched/library/stats/html/stl.html , I encounter error:

"time series contains internal NAs" (when na.action=na.omit), and
"series is not periodic or has less than two periods" (when na.action=na.exclude).

I have double checked that the frequency is correctly defined. I have seen relevant questions in blogs, but didn't find any suggestion that could solve this. Is it not possible to apply stl in a series with missing values? I am very reluctant to interpolate them, as I do not want to be introducing (and consequently detecting...) artifacts. For the same reason, I do not know how advisable it would be to use ARIMA approaches instead (and if missing values would still be a problem).

Please share if you know a way to apply stl in a series with missing values, or if you believe my choices are methodologically not sound, or if you have any better suggestion. I am quite new in the field and overwhelmed by the heaps of (seemingly...) relevant information.

share|improve this question
I'm having the same problem. STL method should be able to just fill in the missing values thru LOESS, but this R implementation does not seems to do so. –  jf328 Apr 24 '13 at 12:11
add comment

1 Answer

ARIMA models easily incorporate dummy variables to deal with missing values. These are called Pulse Indicators . The methodology is straightforward and documented in http://www.unc.edu/~jbhill/tsay.pdf. In general the method extracts from the current residual series information regarding Pulses, Level Shifts, Seasonal Pulses and Local Time Trends.

share|improve this answer
thank you for the suggestion and the very interesting article! –  effie Aug 22 '12 at 15:17
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.