docs: def decompose(self, frequency, window=None, periodic=False):
          '''Use STL to decompose the time series into seasonal, trend, and
          residual components.'''
          R = LazyImport.rpy2()
          if periodic:
              window = 'periodic'
          elif window is None:
              window = frequency
          timestamps = self.timestamps
          series = LazyImport.numpy().array(self.values)
          length = len(series)
          series = R.ts(series, frequency=frequency)
          kwargs = { 's.window': window }
          decomposed = R.robjects.r['stl'](series, **kwargs).rx2('time.series')
          decomposed = [ row for row in decomposed ]
          seasonal = decomposed[0:length]
          trend = decomposed[length:2*length]
          residual = decomposed[2*length:3*length]
          seasonal = TimeSeries(zip(timestamps, seasonal))
          trend = TimeSeries(zip(timestamps, trend))
          residual = TimeSeries(zip(timestamps, residual))
          return DataFrame(seasonal=seasonal, trend=trend, residual=residual)