s-news
[Top] [All Lists]

Seasonal decomposition of a time series with a few missing values

To: <s-news@lists.biostat.wustl.edu>
Subject: Seasonal decomposition of a time series with a few missing values
From: "Vayssières, Marc" <marcv@water.ca.gov>
Date: Mon, 21 Apr 2003 10:32:27 -0700
Thread-index: AcMIK/owHbQ6xcuGRMaoSrkpHb2Q6A==
Thread-topic: Seasonal decomposition of a time series with a few missing values

Dear S-Plus listers,

I would like to use the stl() function (Seasonal-Trend Decomposition using Loess) on long term environmental data. I have monthly time series over 25-30 years, with a few values missing because of equipment failure or accidental loss of the data.

The S-Plus 6.1 implementation of the stl() function will not accept a time series with NAs. I was told by Insightful tech support that currently there is no way to set up stl() so that it will "smooth" over the missing values. I thought this would not be unreasonable since stl is using a sequence of loess smoothings.

Using the na.omit function to remove the NA values from the time series is not a valid solution because stl() does a seasonal decomposition of the time series and periodic position in the time series is very important. For instance if the value for the month of March 1983 is missing, na.omit removes it and then shortens the time series so the value for April 1983 becomes that of March 1983, and so forth.

I was told that a suitable work around (if there is not too many missing values) would be to just replace the NA's with a large number. Since stl() is robust, it will ignore these values in the algorithm, and essentially treat them as missing. What do you think of this solution? Do any of you have a better idea?

Cheers,
 
Marc Vayssières
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marc Vayssières, Ph.D.
Environmental Scientist
California Department of Water Resources
3251 S Street
Sacramento, CA. 95816
(916) 227-7558
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
<Prev in Thread] Current Thread [Next in Thread>
  • Seasonal decomposition of a time series with a few missing values, "Vayssières, Marc" <=