Upload
lyduong
View
236
Download
1
Embed Size (px)
Citation preview
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Chapter 8: Time series analysis - Power spectrum and periodogram
• Time series
• Spectral density
• The periodogram for evenly spaced data
• The (Lomb-Scargle) periodogram for unevenly spaced data
1
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Time series and periodogram analysis
A time series is an ordered sequence of data points, typically some variable quantity measured at successive times.
Examples: temperature measurements at a certain location every 3rd hour a sampled and digitally converted microphone signal the daily stock market index the magnitude or radial velocity of a star measured at irregular points in time
Time series can be regular (evenly sampled) or irregular (unevenly sampled).
A periodogram is a quantitative description of the amount of variation in a time series, separated into frequency components. Other related terms:
spectrum power spectrum power spectral density amplitude spectrum
2
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Power spectral density (PSD)
Let h(t) be a continuous stationary process with E[h] = 0 and Var[h] = !2 at any t. (These are ensemble averages, taken over an infinite set of different possible realizations of the same random process.) In practice we only have the single realization h(t), but for an ergodic process the time averages equal the ensemble averages:
The power spectral density specifies how the variance is divided among different frequencies:
Note: In general both positive and negative frequencies must be considered, and P(−f ) ≠ P( f ). However, for real-valued processes P(−f ) = P( f ), and P( f ) is then often doubled such that only f ≥ 0 should be included in the integral — this is known as the “one-sided power spectrum” and is always used here.
3
P( f )
f
DUHD =! !
�3(I)GI = ֆ�
0
lim7!!
�7
! 7/�
"7/�K(W)GW = � , lim
7!!
�7
! 7/�
"7/�K(W)� GW = ֆ�
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Periodogram
In practice we can only get an estimate of the power spectral density of the process.The periodogram is such an estimate based on a finite set of data, covering the time interval T sampled in N discrete points.
The periodogram has important limitations compared with the theoretical PSD: Finite T implies finite frequency resolution ∆f = 1/T (and a minimum frequency). Finite number of data points N implies that at most N (independent) frequency
components can be estimated (and a maximum frequency) - aliasing Truncation at the endpoints cause distortion of the PSD (frequency leakage).
From a statistical viewpoint the periodogram is a statistic (it is computed from the data), and like other sample statistics is has uncertainties.
To decide if a signal is periodic or not can be treated as a hypothesis test.
We will consider separately:
Periodograms for evenly sampled data ⇒ discrete Fourier transform
Periodograms for unevenly sampled data ⇒ Lomb-Scargle periodogram
4
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
The periodogram for evenly sampled data
Let h(t) be a real-valued continuous process sampled at discrete times tj (j = 0, 1, ..., N−1): hj = h(tj).
The set of paired values {(tj, hj), j = 0, 1, ..., N−1} is called a time series.
For an evenly sampled time series, tj = t0 + j∆t, where ∆t is the sampling interval.
The sampling frequency is fs = 1/∆t, and the Nyquist frequency is fNy = fs/2 = 1/(2∆t)
The total length of the time series is defined as T = N∆t. (Note that tN−1 − t0 = (N−1)∆t < T.)
The periodogram is the continuous function
where i is the imaginary unit. Some important properties of the periodogram:
5
3̂(I) = �ӹW1
!!!!!
1!�!M=�
KM exp(!L MӹWܠ� I )!!!!!
�
(!" I1\
�3̂(I)GI
#= ֆ� lim
1!!
! I�
I�3̂(I)GI =
!
"N="!
! I�
I�3(I+ NIV)GI
3̂(±I+ NIV) = 3̂(I) (illustrated on next pages)
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Time series example (N = 50, Δt = 0.1)
6
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5−3
−2
−1
0
1
2
3
4
5
Time, tj
h j
= T
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Periodogram (fs = 1/Δt = 10): periodic with period fs
7
−25 −20 −15 −10 −5 0 5 10 15 20 2510−3
10−2
10−1
100
101
Frequency f
Estim
ated
P(f)
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Periodogram (only 0 < f < fs): mirrored at fNy
8
0 1 2 3 4 5 6 7 8 9 1010−3
10−2
10−1
100
101
Frequency f
Estim
ated
P(f)
fNy
= fs
∆f = 1/T
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Calculating the periodogram using FFT
The periodogram for real-valued, evenly spaced data is defined by
However, it should never be calculated explicitly from this formula. Mathematically equivalent but much (much!) faster is to use the Fast Fourier Transform (FFT), which is a clever (~ N×log N) algorithm to compute the Discrete Fourier Transform
for any array of M (in general complex) values x0, x1, ..., xM−1. The results Xk are in general complex (even if xj are real). Putting M = N and xj = hj, we clearly have
This is shown on the next page. A disadvantage is that the periodogram is only computed for the discrete frequencies fk = k/∆t (circles in the diagram on next page).
9
3̂(I) = �ӹW1
!!!!!
1!�!M=�
KM exp(!L MӹWܠ� I )!!!!!
�
;N =0!�!M=�
[M exp(!L (NMܠ� , N = �, �, . . . ,0! �
3̂(IN) =�ӹW1 |;N|� , IN = N/ӹW , N = �, �, . . . ,1! �
0 1 2 3 4 5 6 7 8 9 1010−3
10−2
10−1
100
101
Frequency f
Estim
ated
P(f)
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Periodogram sampled at f = 0, Δf, 2Δf, ...
10
fNy
= fs
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Interpolating the periodogram using FFT
Actually the FFT can be used to compute the periodogram for arbitrarily dense frequency points. For example, if the periodogram of the previous time series (N = 50, T = 5) needs to be sampled four times denser than in the previous plot (i.e., using ∆f = 0.05 instead of 0.2), one simply makes the time series four times longer by adding zeroes:
See next page, where the circles show the calculated points. (The “continuous” periodogram on p. 11 was computed this way with an 80 times oversampling.)
Note: The zero-padding just provides an interpolation of the basic periodogram at fk = k/(N∆t) and therefore does not add any information, only makes the plot “nicer”.
11
0 = �1 , [M =
��
�KM LI M < 1
� RWKHUZLVH, {;N} = ))7(
�[M
�)
� 3̂(IN) =�ӹW1 |;N|� , IN = N/(0ӹW) , N = �, �, . . . ,0� �
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Four times oversampled periodogram
12
0 1 2 3 4 5 6 7 8 9 1010−3
10−2
10−1
100
101
Frequency f
Estim
ated
P(f)
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 13
Illustrating sampling / aliasing / truncation effects
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 14
Example periodograms, noise-free data
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 15
Example periodograms, noise-free data
Aliasing: f > fc is reflected in fc
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 16
Example periodograms, noise-free data
Longer time span ⇒ higher frequency resolution
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 17
Example periodograms, noise-free data
Non-integer number of periods ⇒ frequency leakage
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 18
Example periodograms, noise-free data
Longer time span ⇒ higher resolution ⇒ less frequency leakage
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 19
Example periodograms, noisy data
White noise ⇒ "constant" power (values follow exponential distribution)
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 20
Example periodograms, noisy data
Periodic signal + white noise ⇒ "constant" power + peak
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 21
Example periodograms, noisy data
More data points ⇒ less noise power per frequency point
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Unevenly sampled data (1/5)
22
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Unevenly sampled data (2/5)
23
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Unevenly sampled data (3/5)
24
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Unevenly sampled data (4/5)
25
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p.
Unevenly sampled data (5/5)
26
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 27
Example periodograms, noisy data, unevenly sampled
Random sampling ⇒ good frequency coverage (no aliasing!)
n = 320;mjd = rand([n 1])*320;
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 28
Checking found period (p) by folding the data
Phase (φ) of sample j is
Is scatter about the mean curve consistent with errors?
ASTM21 Chapter 8: Time series analysis - Power spectrum and periodogram p. 29
Example periodograms, noisy data, unevenly sampled
Non-random sampling ⇒ look out for frequency window effects!
n = 320;mjd = rand([n 1])*320;for j = 1:n if (mod(mjd(j),1)>0.5) mjd(j) = mjd(j) - 0.5; endend