[R] StructTS fitting problem - can anyone help?

John Stollberg coffeevore at hotmail.com
Thu Apr 14 12:58:33 CEST 2011

I have seen a couple of posts about this, but no solutions. The problem is fitting the Basic Structural Model (BSM) to the AirPassengers time series using StructTS.  For this particular time series, if the length is reduced below 140 months, the BSM fits are bad. 
The following illustrates the problem
ap0 <- log10(AirPassengers) - 2ap<-ts(ap0[1:139], freq=12)  # bad fits for length < 140(fit <- StructTS(ap, type= "BSM"))ftd<-fitted(fit)plot(cbind(ap, ftd[,1], ftd[,3]), # data, level, cyclic terms     plot.type = "single", col=c("black", "red", "green"))abline(h=0, col="gray60")
A plot is attached, for series lengths 139 and 140. The red line is the fitted level and the green line is the seasonal term.  Clearly, for length = 139, the red line does not represent a local average level, and the green line does not represent a zero mean cyclic term with a period of 12 months.  
Can anyone help with this?  I've noticed this problem with other time series, and I'm very interested in the solution.

More information about the R-help mailing list