estspec
- quantecon.estspec.ar_periodogram(x, window='hanning', window_len=7)[source]
Compute periodogram from data x, using prewhitening, smoothing and recoloring. The data is fitted to an AR(1) model for prewhitening, and the residuals are used to compute a first-pass periodogram with smoothing. The fitted coefficients are then used for recoloring.
- Parameters:
- xarray_like(float)
A flat NumPy array containing the data to smooth
- window_lenscalar(int), optional
An odd integer giving the length of the window. Defaults to 7.
- windowstring
A string giving the window type. Possible values are ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’ or ‘blackman’
- Returns:
- warray_like(float)
Fourier frequencies at which periodogram is evaluated
- I_warray_like(float)
Values of periodogram at the Fourier frequencies
- quantecon.estspec.periodogram(x, window=None, window_len=7)[source]
Computes the periodogram
\[I(w) = \frac{1}{n} \Big[ \sum_{t=0}^{n-1} x_t e^{itw} \Big] ^2\]at the Fourier frequencies \(w_j := \frac{2 \pi j}{n}\), \(j = 0, \dots, n - 1\), using the fast Fourier transform. Only the frequencies \(w_j\) in \([0, \pi]\) and corresponding values \(I(w_j)\) are returned. If a window type is given then smoothing is performed.
- Parameters:
- xarray_like(float)
A flat NumPy array containing the data to smooth
- window_lenscalar(int), optional(default=7)
An odd integer giving the length of the window. Defaults to 7.
- windowstring
A string giving the window type. Possible values are ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’ or ‘blackman’
- Returns:
- warray_like(float)
Fourier frequencies at which periodogram is evaluated
- I_warray_like(float)
Values of periodogram at the Fourier frequencies
- quantecon.estspec.smooth(x, window_len=7, window='hanning')[source]
Smooth the data in x using convolution with a window of requested size and type.
- Parameters:
- xarray_like(float)
A flat NumPy array containing the data to smooth
- window_lenscalar(int), optional
An odd integer giving the length of the window. Defaults to 7.
- windowstring
A string giving the window type. Possible values are ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’ or ‘blackman’
- Returns:
- array_like(float)
The smoothed values
Notes
Application of the smoothing window at the top and bottom of x is done by reflecting x around these points to extend it sufficiently in each direction.