s <- new.ssa(co2) # Perform the decomposition using the default window length
summary(s) # Show various information about the decomposition
plot(s) # Show the plot of the eigenvalues
f <- reconstruct(s, groups = list(1, c(2, 3), 4)) # Reconstruct into 3 series
plot(co2) # Plot the original series
lines(f$F1, col = "blue") # Extract the trend
lines(f$F1+f$F2, col = "red") # Add the periodicity
lines(f$F1+f$F2+f$F3, col = "green") # Add slow-varying component
Run the code above in your browser using DataLab