[R] StructTS hang?

rkevinburton at charter.net rkevinburton at charter.net
Thu Oct 2 18:52:36 CEST 2008

I was wondering if I could get some advice on how best to diagnose a problem that I am having with StructTS. To illlustrate the problem I have generated a rigged time series:

genseq <- function()
  x <- numeric(4*365)
  s <- seq(as.Date("2005-01-01"), as.Date("2008-12-31"), by="month")
  ob <- as.vector(s[c(10,22,34,46)] - as.Date("2005-01-01"))
  oe <- as.vector(s[c(11,23,35,47)] - as.Date("2005-01-01"))
  for(.index in 1:length(ob))
    x[ob[.index]:(oe[.index] - 1)] <- 1 
  return(ts(x, frequency=365))

series <- genseq()
series <- ts(c(series, rep(0, nextn(length(series)) - length(series))), frequency = 365)
fit <- StructTS(series)
plot(cbind(fitted(fit), resids=resid(fit)), main = "StructTS decomposition")

This call to StructTS seems to hang indefinitely. 

Any ideas?

Thank you.


More information about the R-help mailing list