The simulation smoother for time series models