Hi mailinglist members,

 

I’m actually working on a time series prediction and my current approach is
to decompose the series first into a trend, a seasonal component and a
remainder. Therefore I’m using the stl() function. But I’m wondering how to
get the single components in order to predict the particular fitted series’.

This code snippet illustrates my problem:

 

series <- vector(length=300)

noise <- rnorm(300,0,2)

time <- 1:300

series[1] <- noise[1]

 

for(i in 3:300){

            series[i] <- 0.5*series[i-1]+ noise[i] + 0.01*time[i]

}

seriesTs <- ts(series, start=c(1980,1), frequency=12)

 

decomp <- stl(seriesTs ,"periodic")

plot(decomp)

llrSaison <- loess(seriesTs~time , span=decomp$win[1] ,
degree=decomp$deg[1])

llrTrend  <- loess(seriesTs~time,  span=decomp$win[2] ,
degree=decomp$deg[2])

 

plot(llrSaison$fitted)

 

The last plot differs much from the seasonal plot in the plot(decomp) call.
This is why the llr estimator doesn’t extract the seasonal component, but
how can I predict the single components at last? Or is there a function
which can predict the values of the stl-object. Predict() doesn’t work, I’ve
already tried it.

 

All the best,

Konrad Hoppe 


	[[alternative HTML version deleted]]

