Lomb-Scargle Phase Shift Formula and Examples

advertisement
Lomb-Scargle Phase Shift Formula and Examples
efg, 17 August 2007
This analysis assumes Lomb-Scargle code is available from the LombScargle.zip from
http://research.stowers-institute.org/efg/2005/LombScargle/R/index.htm.
source("LombScargle.R")
Run this R Code:
unit <<- "hour" # hourly data
set.seed(19)
# make this example reproducible
time <- sort( runif(48, 0, 48) )
Amplitude <- 1.5
PeriodExact <- 48
PhaseShiftExact <- pi/2
Expression <- Amplitude * cos(2*pi*time/PeriodExact
- PhaseShiftExact)
M <- 4*length(time) # often 2 or 4
# Use test frequencies corresponding to
# periods from 8 hours to 96 hours
TestFrequencies <- (1/96) + (1/8 - 1/96) * (1:M / M)
# Use Horne & Baliunas' estimate of independent frequencies
Nindependent <- NHorneBaliunas(length(Expression))
LS <- ComputeAndPlotLombScargle(time, Expression,
TestFrequencies, Nindependent,
"Cosine Curve")
Time Interval Variability
15
0
-1.5
5
10
Frequency
0.5
-0.5 0.0
Expression
1.0
20
1.5
Cosine Curve
N = 48
20
30
-1.0
-0.5
0.0
0.5
Lomb-Scargle Periodogram
Period at Peak = 47.3 hours
Peak Significance
p = 5.14e-09 at Peak
1.0
0.8
1.0
log10(delta T)
20
25
40
Time [hours]
10
p = 0.001
0.6
0.0
5
p = 0.01
p = 0.05
0.4
p = 1e-04
Probability
p = 1e-05
0.2
15
p = 1e-06
0
Normalized Power Spectral Density
10
0.02
0.04
0.06
0.08
0.10
Frequency [1/hour]
LombScargle-PhaseShift.doc 17 Aug 2007
0.12
0.02
0.04
0.06
0.08
0.10
0.12
Frequency [1/hour]
1
Lomb-Scargle Phase Shift Formula and Examples
At this point the LS list has several variables of interest, which can be plotted:
plot(LS$t.all, LS$h.all)
lines(LS$t.all, LS$h.loess)
points(LS$h.peak$maximum, LS$h.peak$objective, pch=PCH_CIRCLE, col="black", cex=2)
0.0
-1.0
-0.5
LS$h.all
0.5
1.0
Plot the original raw data points (circles), and the loess smoothed curve (black line). The "optimal"
point is shown by a black point
10
20
30
40
LS$t.all
This "optimal" point is at (LS$h.peak$maximum, LS$h.peak$objective)
> LS$h.peak$maximum TimeOffset
[1] 10.98842
> LS$h.peak$objective
[1] 0.9016772
LombScargle-PhaseShift.doc 17 Aug 2007
2
Lomb-Scargle Phase Shift Formula and Examples
The Lomb-Scargle period is given by
> LS$PeakPeriod
[1] 47.26154
The maximum of the original time series is probably the best to determine the amplitude of the cosine
curve.
> Amplitude <- max(LS$h.all)
> Amplitude
[1] 1.498046
A cosine curve based on the Lomb-Scargle analysis is:
y = Amplitude * cos
2 * π * Time − 2 * π * TimeOffset
Period
y = Amplitude * cos
2 * π * (Time − TimeOffset )
Period
The phase shift in 0 .. 2p can be defined:
PhaseShift =
2 * π * TimeOffset
Period
An alternative form of the equation is:
 2 * π * Time

y = Amplitude * cos
− PhaseShift 
 Period

This "mathematical curve" can be overlaid on the original plot (in red):
LombScargle-PhaseShift.doc 17 Aug 2007
3
Lomb-Scargle Phase Shift Formula and Examples
0.0
-1.5
-1.0
-0.5
LS$h.all
0.5
1.0
1.5
> plot(LS$t.all, LS$h.all)
> lines(LS$t.all, LS$h.loess)
> points(LS$h.peak$maximum,LS$h.peak$objective, pch=PCH_CIRCLE, col="black")
>
> Period <- LS$PeakPeriod
> Period
[1] 47.26154
>
> Amplitude <- max(LS$h.all)
> Amplitude
[1] 1.498046
>
> T <- 0:48
> y <- Amplitude * cos(2*pi*(T - LS$h.peak$maximum) / LS$PeakPeriod)
> points(T, y, col="red")
>
> PhaseShift <- 2*pi*LS$h.peak$maximum / LS$PeakPeriod
> PhaseShift
[1] 1.460855
>
> PhaseShiftError <- PhaseShiftExact - PhaseShift
> PhaseShiftErrorPercent <- 100 * PhaseShiftError / PhaseShiftExact
> PhaseShiftError
[1] 0.1099415
> PhaseShiftErrorPercent
[1] 6.999091
10
20
30
40
LS$t.all
Perhaps, a more exact time shift could be found by shifting the red curve above and finding an optimal
correlation with the original data.
LombScargle-PhaseShift.doc 17 Aug 2007
4
Lomb-Scargle Phase Shift Formula and Examples
Other Examples:
Amplitude <- 2.0
PeriodExact <- 36
PhaseShiftExact <- pi/8
Expression <- Amplitude * cos(2*pi*time/PeriodExact
Time Interval Variability
5
0
-2
N = 48
20
30
40
-1.0
-0.5
0.0
0.5
log10(delta T)
Lomb-Scargle Periodogram
Period at Peak = 36.9 hours
Peak Significance
p = 4.94e-09 at Peak
1.0
0.8
1.0
Time [hours]
20
25
10
10
p = 0.001
0.6
0.0
5
p = 0.01
p = 0.05
0.4
p = 1e-04
Probability
p = 1e-05
0.2
15
p = 1e-06
0
Normalized Power Spectral Density
10
Frequency
0
-1
Expression
1
15
2
20
Cosine Curve
- PhaseShiftExact)
0.02
0.04
0.06
0.08
0.10
0.12
0.02
0.04
0.06
0.08
0.10
0.12
Frequency [1/hour]
0
-2
-1
LS$h.all
1
2
Frequency [1/hour]
10
20
30
40
LS$t.all
> Period
[1] 36.864
> Amplitude
[1] 1.999809
> PhaseShift
[1] 6.50696
# answer can have extra 2p
> pi/8 + 2*pi
[1] 6.675884
% Error (adjusted) = -2.53
LombScargle-PhaseShift.doc 17 Aug 2007
5
Lomb-Scargle Phase Shift Formula and Examples
Amplitude <- 0.001
PeriodExact <- 45
PhaseShiftExact <- pi
Expression <- Amplitude * cos(2*pi*time/PeriodExact
Time Interval Variability
15
N = 48
20
30
40
-1.0
-0.5
0.0
0.5
log10(delta T)
Lomb-Scargle Periodogram
Period at Peak = 43.6 hours
Peak Significance
p = 3.44e-09 at Peak
1.0
0.8
1.0
Time [hours]
20
25
10
p = 1e-04
10
p = 0.001
0.0
5
0.2
p = 0.01
p = 0.05
0.6
p = 1e-05
0.4
Probability
15
p = 1e-06
0
Normalized Power Spectral Density
10
Frequency
0
5
-1e-03 -5e-04 0e+00
Expression
5e-04
20
1e-03
Cosine Curve
- PhaseShiftExact)
0.02
0.04
0.06
0.08
0.10
0.12
0.02
0.04
0.06
0.08
0.10
0.12
Frequency [1/hour]
0e+00
-1e-03
-5e-04
LS$h.all
5e-04
1e-03
Frequency [1/hour]
10
20
30
40
LS$t.all
> Amplitude
[1] 0.0009977873
> PhaseShift
[1] 3.221355
> PhaseShiftError
[1] -0.07976247
> PhaseShiftErrorPercent
[1] -2.538918
LombScargle-PhaseShift.doc 17 Aug 2007
6
Lomb-Scargle Phase Shift Formula and Examples
Amplitude <- 1
PeriodExact <- 48
PhaseShiftExact <- 0
Expression <- Amplitude * cos(2*pi*time/PeriodExact
Time Interval Variability
15
5
0
-1.0
N = 48
20
30
40
-1.0
-0.5
0.0
0.5
log10(delta T)
Lomb-Scargle Periodogram
Period at Peak = 43.6 hours
Peak Significance
p = 3.93e-09 at Peak
1.0
0.8
1.0
Time [hours]
20
25
10
10
p = 0.001
0.6
0.0
5
p = 0.01
p = 0.05
0.4
p = 1e-04
Probability
p = 1e-05
0.2
15
p = 1e-06
0
Normalized Power Spectral Density
10
Frequency
0.0
-0.5
Expression
0.5
20
1.0
Cosine Curve
- PhaseShiftExact)
0.02
0.04
0.06
0.08
0.10
0.12
0.02
0.04
0.06
0.08
0.10
0.12
Frequency [1/hour]
0.0
-1.0
-0.5
LS$h.all
0.5
1.0
Frequency [1/hour]
10
20
30
40
LS$t.all
> Period
[1] 43.57447
> Amplitude
[1] 0.9665584
> PhaseShift # answer can have extra 2p
[1] 6.63563
> 2*pi
[1] 6.283185
LombScargle-PhaseShift.doc 17 Aug 2007
7
Download