Skip to content
Prev 247811 / 398503 Next

Semi-Regular Time Series with Missing Values

On Wed, Jan 19, 2011 at 5:21 PM, Adam Oliner <oliner at gmail.com> wrote:
I think what you want is:

library(zoo)

library(zoo)
data <- c(50, 32, 22, 13, 14, 6, 12, 3, 6, 21, NA, NA, 15, 13, 17, 9,
11, 34, 63)
z <- zooreg(data, frequency = 2)
stl(z)

or equivalently

tt <- ts(data, frequency = 2)
stl(tt)

however stl does not support series with NAs so that can't work with
your data and specifying na.action won't help since that is equivalent
to stl(na.action(as.ts(z))).  Also note that na.action's value is a
function and na.action = F is illegal unless you have a function
called F in your workspace.

These work in so far as they give an answer but whether they are
acceptable is up to you:

stl(z[1:01], "per")
stl(z[13:19], "per")
stl(na.approx(z), "per")