SlideShare a Scribd company logo
Environmental Data Analysis with MatLab
Lecture 18:
Cross-correlation
Lecture 01 Using MatLab
Lecture 02 Looking At Data
Lecture 03 Probability and Measurement Error
Lecture 04 Multivariate Distributions
Lecture 05 Linear Models
Lecture 06 The Principle of Least Squares
Lecture 07 Prior Information
Lecture 08 Solving Generalized Least Squares Problems
Lecture 09 Fourier Series
Lecture 10 Complex Fourier Series
Lecture 11 Lessons Learned from the Fourier Transform
Lecture 12 Power Spectral Density
Lecture 13 Filter Theory
Lecture 14 Applications of Filters
Lecture 15 Factor Analysis
Lecture 16 Orthogonal functions
Lecture 17 Covariance and Autocorrelation
Lecture 18 Cross-correlation
Lecture 19 Smoothing, Correlation and Spectra
Lecture 20 Coherence; Tapering and Spectral Analysis
Lecture 21 Interpolation
Lecture 22 Hypothesis testing
Lecture 23 Hypothesis Testing continued; F-Tests
Lecture 24 Confidence Limits of Spectra, Bootstraps
SYLLABUS
purpose of the lecture
generalize the idea of autocorrelation
to multiple time series
Review of last lecture
autocorrelation
correlations between samples within a
time series
high degree of short-term correlation
what ever the river was doing yesterday, its probably
doing today, too
because water takes time to drain away
0 500 1000 1500 2000 2500 3000 3500 4000
0
1
2
x 10
4
time, days
discharge,
cfs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
2
4
6
8
x 10
9
frequency, cycles per day
PSD,
(cfs)
2
per
cycle/day
A) time series, d(t)
time t, days
d(t),
cfs
Neuse River Hydrograph
low degree of intermediate-term correlation
what ever the river was doing last month, today it could
be doing something completely different
because storms are so unpredictable
0 500 1000 1500 2000 2500 3000 3500 4000
0
1
2
x 10
4
time, days
discharge,
cfs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
2
4
6
8
x 10
9
frequency, cycles per day
PSD,
(cfs)
2
per
cycle/day
A) time series, d(t)
time t, days
d(t),
cfs
Neuse River Hydrograph
moderate degree of long-term correlation
what ever the river was doing this time last year, its
probably doing today, too
because seasons repeat
0 500 1000 1500 2000 2500 3000 3500 4000
0
1
2
x 10
4
time, days
discharge,
cfs
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
0
2
4
6
8
x 10
9
frequency, cycles per day
PSD,
(cfs)
2
per
cycle/day
A) time series, d(t)
time t, days
d(t),
cfs
Neuse River Hydrograph
0 0.5 1 1.5 2 2.5
x 10
4
0
0.5
1
1.5
2
2.5
x 10
4
discharge
discharge
lagged
by
1
days
0 0.5 1 1.5 2 2.5
x 10
4
0
0.5
1
1.5
2
2.5
x 10
4
discharge
discharge
lagged
by
3
days
0 0.5 1 1.5 2 2.5
x 10
4
0
0.5
1
1.5
2
2.5
x 10
4
discharge
discharge
lagged
by
30
days
1 day 3 days 30 days
-30 -20 -10 0 10 20 30
0
5
x 10
6
lag, days
autocorrelation
-3000 -2000 -1000 0 1000 2000 3000
-5
0
5
x 10
6
lag, days
autocorrelation
Autocorrelation Function
3
1 30
formula for covariance
formula for autocorrelation
autocorrelation
at lag (k-1)Δt
autocorrelation similar to convolution
autocorrelation similar to convolution
note difference in sign
autocorrelation in MatLab
Important Relation #1
autocorrelation is the convolution of a
time series with its time-reversed self
Important Relationship #2
Fourier Transform of an autocorrelation
is proportional to the
Power Spectral Density of time series
End of Review
Part 1
correlations between time-series
scenario
discharge correlated with rain
but discharge is delayed behind rain
because rain takes time to drain
from the land
time, days
time, days
rain,
mm/day
dischagre,
m
3
/s
time, days
time, days
rain,
mm/day
dischagre,
m
3
/s
rain ahead of
discharge
time, days
time, days
rain,
mm/day
dischagre,
m
3
/s
shape not
exactly the
same, either
treat two time series u and v probabilistically
p.d.f.
p(ui, vi+k-1)
with elements lagged by time
(k-1)Δt
and compute its covariance
this defines the cross-correlation
just a generalization of the auto-correlation
different times in
the same time series
different times in
different time series
like autocorrelation, similar to convolution
As with auto-correlation
two important properties
#1: relationship to convolution
#2: relationship to Fourier Transform
As with auto-correlation
two important properties
#1: relationship to convolution
#2: relationship to Fourier Transform
cross-spectral density
cross-correlation in MatLab
Part 2
aligning time-series
a simple application of cross-correlation
central idea
two time series are best aligned
at the lag at which they are most correlated,
which is
the lag at which their cross-correlation is maximum
10 20 30 40 50 60 70 80 90 100
-1
0
1
0
1
u(t)
v(t)
two similar time-series, with a time shift
(this is simple “test” or “synthetic” dataset)
-20 -10 0 10 20
-5
0
5
time
cross-correlation
cross-correlate
-20 -10 0 10 20
-5
0
5
time
cross-correlation
maximum
time lag
find maximum
In MatLab
In MatLab
compute cross-
correlation
In MatLab
compute cross-
correlation
find maximum
In MatLab
compute cross-
correlation
find maximum
compute time lag
10 20 30 40 50 60 70 80 90 100
-1
0
10 20 30 40 50 60 70 80 90 100
-1
0
1
u(t)
v(t+tlag)
align time series with measured lag
A)
B)
2 4 6 8 10 12 14
0
500
time, days
solar,
W/m2
2 4 6 8 10 12 14
0
50
100
time, days
ozone,
ppb
500
W/m2
solar insolation and ground level ozone
(this is a real dataset from West Point NY)
B)
2 4 6 8 10 12 14
0
500
time, days
solar,
W/m2
2 4 6 8 10 12 14
0
50
100
time, days
ozone,
ppb
500
W/m2
solar insolation and ground level ozone
note time lag
-10 -5 0 5 10
0
1
2
3
4
x 10
6
time, hours
cross-correlation
C)
maximum
time lag
3 hours
0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
500
time, days
solar
radiation,
W/m2
0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
50
100
3.00 hour lag
time, days
ozone,
ppb
A)
B)
original
delagged

More Related Content

Similar to lec18.pptx

2013 pb prediction of rise time errors of a cascade of equal behavioral cells.
2013 pb prediction of  rise time errors of a cascade of equal behavioral cells.2013 pb prediction of  rise time errors of a cascade of equal behavioral cells.
2013 pb prediction of rise time errors of a cascade of equal behavioral cells.
Piero Belforte
 
6주차
6주차6주차
6주차
Sangho Lee
 
PosterRexChinHaoChen2016
PosterRexChinHaoChen2016PosterRexChinHaoChen2016
PosterRexChinHaoChen2016
Rex Chin-Hao Chen
 
lab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docx
lab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docxlab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docx
lab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docx
DIPESH30
 
Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...
Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...
Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...
Kellen Betts
 
Optical Absoprtion of Thin Film Semiconductors
Optical Absoprtion of Thin Film SemiconductorsOptical Absoprtion of Thin Film Semiconductors
Optical Absoprtion of Thin Film Semiconductors
Enrico Castro
 
100-423-1-PB.pdf
100-423-1-PB.pdf100-423-1-PB.pdf
100-423-1-PB.pdf
AnimeshKumar787928
 
Final
FinalFinal
A study on evacuation performance of sit type water closet by computational f...
A study on evacuation performance of sit type water closet by computational f...A study on evacuation performance of sit type water closet by computational f...
A study on evacuation performance of sit type water closet by computational f...
combi07
 
1,2. Dimensional Analysis and fluid .pptx
1,2. Dimensional Analysis and fluid .pptx1,2. Dimensional Analysis and fluid .pptx
1,2. Dimensional Analysis and fluid .pptx
MuhammadHabib533231
 
mox66
mox66mox66
TuckerHEDPSummer2016Presentation
TuckerHEDPSummer2016PresentationTuckerHEDPSummer2016Presentation
TuckerHEDPSummer2016Presentation
Tucker Hartland
 
DIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHOD
DIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHODDIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHOD
DIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHOD
Piero Belforte
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
ssusercf6d0e
 
Numerical study on free-surface flow
Numerical study on free-surface flowNumerical study on free-surface flow
Numerical study on free-surface flow
miguelpgomes07
 
Basic Theory & Formulae Training Module
Basic Theory & Formulae Training ModuleBasic Theory & Formulae Training Module
Basic Theory & Formulae Training Module
CookLegacyTraining
 
The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...
The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...
The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...
Dan Hillman
 
1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...
1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...
1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...
Aminullah Assagaf
 
Hamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CAHamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CA
csitconf
 
Hamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CAHamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CA
cscpconf
 

Similar to lec18.pptx (20)

2013 pb prediction of rise time errors of a cascade of equal behavioral cells.
2013 pb prediction of  rise time errors of a cascade of equal behavioral cells.2013 pb prediction of  rise time errors of a cascade of equal behavioral cells.
2013 pb prediction of rise time errors of a cascade of equal behavioral cells.
 
6주차
6주차6주차
6주차
 
PosterRexChinHaoChen2016
PosterRexChinHaoChen2016PosterRexChinHaoChen2016
PosterRexChinHaoChen2016
 
lab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docx
lab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docxlab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docx
lab 4 requermenrt.pdfMECH202 – Fluid Mechanics – 2015 Lab .docx
 
Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...
Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...
Multi-Fidelity Optimization of a High Speed, Foil-Assisted Catamaran for Low ...
 
Optical Absoprtion of Thin Film Semiconductors
Optical Absoprtion of Thin Film SemiconductorsOptical Absoprtion of Thin Film Semiconductors
Optical Absoprtion of Thin Film Semiconductors
 
100-423-1-PB.pdf
100-423-1-PB.pdf100-423-1-PB.pdf
100-423-1-PB.pdf
 
Final
FinalFinal
Final
 
A study on evacuation performance of sit type water closet by computational f...
A study on evacuation performance of sit type water closet by computational f...A study on evacuation performance of sit type water closet by computational f...
A study on evacuation performance of sit type water closet by computational f...
 
1,2. Dimensional Analysis and fluid .pptx
1,2. Dimensional Analysis and fluid .pptx1,2. Dimensional Analysis and fluid .pptx
1,2. Dimensional Analysis and fluid .pptx
 
mox66
mox66mox66
mox66
 
TuckerHEDPSummer2016Presentation
TuckerHEDPSummer2016PresentationTuckerHEDPSummer2016Presentation
TuckerHEDPSummer2016Presentation
 
DIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHOD
DIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHODDIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHOD
DIGITAL WAVE FORMULATION OF QUASI-STATIC PEEC METHOD
 
Chapter 3.pdf
Chapter 3.pdfChapter 3.pdf
Chapter 3.pdf
 
Numerical study on free-surface flow
Numerical study on free-surface flowNumerical study on free-surface flow
Numerical study on free-surface flow
 
Basic Theory & Formulae Training Module
Basic Theory & Formulae Training ModuleBasic Theory & Formulae Training Module
Basic Theory & Formulae Training Module
 
The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...
The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...
The Elegant Nature of the Tschebyscheff Impedance Transformer and Its Utility...
 
1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...
1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...
1 Aminullah Assagaf_Estimation-of-domain-of-attraction-for-the-fract_2021_Non...
 
Hamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CAHamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CA
 
Hamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CAHamming Distance and Data Compression of 1-D CA
Hamming Distance and Data Compression of 1-D CA
 

Recently uploaded

Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
ramrag33
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
architagupta876
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 

Recently uploaded (20)

Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
AI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptxAI assisted telemedicine KIOSK for Rural India.pptx
AI assisted telemedicine KIOSK for Rural India.pptx
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 

lec18.pptx

  • 1. Environmental Data Analysis with MatLab Lecture 18: Cross-correlation
  • 2. Lecture 01 Using MatLab Lecture 02 Looking At Data Lecture 03 Probability and Measurement Error Lecture 04 Multivariate Distributions Lecture 05 Linear Models Lecture 06 The Principle of Least Squares Lecture 07 Prior Information Lecture 08 Solving Generalized Least Squares Problems Lecture 09 Fourier Series Lecture 10 Complex Fourier Series Lecture 11 Lessons Learned from the Fourier Transform Lecture 12 Power Spectral Density Lecture 13 Filter Theory Lecture 14 Applications of Filters Lecture 15 Factor Analysis Lecture 16 Orthogonal functions Lecture 17 Covariance and Autocorrelation Lecture 18 Cross-correlation Lecture 19 Smoothing, Correlation and Spectra Lecture 20 Coherence; Tapering and Spectral Analysis Lecture 21 Interpolation Lecture 22 Hypothesis testing Lecture 23 Hypothesis Testing continued; F-Tests Lecture 24 Confidence Limits of Spectra, Bootstraps SYLLABUS
  • 3. purpose of the lecture generalize the idea of autocorrelation to multiple time series
  • 4. Review of last lecture autocorrelation correlations between samples within a time series
  • 5. high degree of short-term correlation what ever the river was doing yesterday, its probably doing today, too because water takes time to drain away
  • 6. 0 500 1000 1500 2000 2500 3000 3500 4000 0 1 2 x 10 4 time, days discharge, cfs 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0 2 4 6 8 x 10 9 frequency, cycles per day PSD, (cfs) 2 per cycle/day A) time series, d(t) time t, days d(t), cfs Neuse River Hydrograph
  • 7. low degree of intermediate-term correlation what ever the river was doing last month, today it could be doing something completely different because storms are so unpredictable
  • 8. 0 500 1000 1500 2000 2500 3000 3500 4000 0 1 2 x 10 4 time, days discharge, cfs 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0 2 4 6 8 x 10 9 frequency, cycles per day PSD, (cfs) 2 per cycle/day A) time series, d(t) time t, days d(t), cfs Neuse River Hydrograph
  • 9. moderate degree of long-term correlation what ever the river was doing this time last year, its probably doing today, too because seasons repeat
  • 10. 0 500 1000 1500 2000 2500 3000 3500 4000 0 1 2 x 10 4 time, days discharge, cfs 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0 2 4 6 8 x 10 9 frequency, cycles per day PSD, (cfs) 2 per cycle/day A) time series, d(t) time t, days d(t), cfs Neuse River Hydrograph
  • 11. 0 0.5 1 1.5 2 2.5 x 10 4 0 0.5 1 1.5 2 2.5 x 10 4 discharge discharge lagged by 1 days 0 0.5 1 1.5 2 2.5 x 10 4 0 0.5 1 1.5 2 2.5 x 10 4 discharge discharge lagged by 3 days 0 0.5 1 1.5 2 2.5 x 10 4 0 0.5 1 1.5 2 2.5 x 10 4 discharge discharge lagged by 30 days 1 day 3 days 30 days
  • 12. -30 -20 -10 0 10 20 30 0 5 x 10 6 lag, days autocorrelation -3000 -2000 -1000 0 1000 2000 3000 -5 0 5 x 10 6 lag, days autocorrelation Autocorrelation Function 3 1 30
  • 16. autocorrelation similar to convolution note difference in sign
  • 18. Important Relation #1 autocorrelation is the convolution of a time series with its time-reversed self
  • 19. Important Relationship #2 Fourier Transform of an autocorrelation is proportional to the Power Spectral Density of time series
  • 22. scenario discharge correlated with rain but discharge is delayed behind rain because rain takes time to drain from the land
  • 26. treat two time series u and v probabilistically p.d.f. p(ui, vi+k-1) with elements lagged by time (k-1)Δt and compute its covariance
  • 27. this defines the cross-correlation
  • 28. just a generalization of the auto-correlation different times in the same time series different times in different time series
  • 30. As with auto-correlation two important properties #1: relationship to convolution #2: relationship to Fourier Transform
  • 31. As with auto-correlation two important properties #1: relationship to convolution #2: relationship to Fourier Transform cross-spectral density
  • 33. Part 2 aligning time-series a simple application of cross-correlation
  • 34. central idea two time series are best aligned at the lag at which they are most correlated, which is the lag at which their cross-correlation is maximum
  • 35. 10 20 30 40 50 60 70 80 90 100 -1 0 1 0 1 u(t) v(t) two similar time-series, with a time shift (this is simple “test” or “synthetic” dataset)
  • 36. -20 -10 0 10 20 -5 0 5 time cross-correlation cross-correlate
  • 37. -20 -10 0 10 20 -5 0 5 time cross-correlation maximum time lag find maximum
  • 41. In MatLab compute cross- correlation find maximum compute time lag
  • 42. 10 20 30 40 50 60 70 80 90 100 -1 0 10 20 30 40 50 60 70 80 90 100 -1 0 1 u(t) v(t+tlag) align time series with measured lag
  • 43. A) B) 2 4 6 8 10 12 14 0 500 time, days solar, W/m2 2 4 6 8 10 12 14 0 50 100 time, days ozone, ppb 500 W/m2 solar insolation and ground level ozone (this is a real dataset from West Point NY)
  • 44. B) 2 4 6 8 10 12 14 0 500 time, days solar, W/m2 2 4 6 8 10 12 14 0 50 100 time, days ozone, ppb 500 W/m2 solar insolation and ground level ozone note time lag
  • 45. -10 -5 0 5 10 0 1 2 3 4 x 10 6 time, hours cross-correlation C) maximum time lag 3 hours
  • 46. 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 500 time, days solar radiation, W/m2 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 50 100 3.00 hour lag time, days ozone, ppb A) B) original delagged

Editor's Notes

  1. Today’s lecture expands the idea of correlations within time series to correlations between time series.
  2. The key idea is that points in one time series can be correlated to points in a different time series, and the idea of covariance can be applied to quantify the correlation.
  3. Last lecture we derived the autocorrelation function. It expresses the degree of correlation of two points in a time series, separated by a lag, Up to a multiplicative constant, it is just the covariance.
  4. Time series usually differ in the degree of correlation of points with different lags. Usually, points with small lags are highly correlated.
  5. Pairs of points (red) separated by a few days tend to have the same value.
  6. The correlation decreases as the lag increases.
  7. Pairs of points (red) separated by a month tend to have different values. Some are high-high, some hi-low, so the correlation averages out to near-zero.
  8. Pairs of points (red) separated by a year tend to have similar values. Because of the precipitation has an annual cycle.
  9. The scatter plot is more linear (meaning more highly correlated) for the shorter lags.
  10. Autocorrelation function of the Neuse River hydrograph. The 1, 3, and 30 day correlations from the previous slide are highlighted in red.
  11. This is the formula for the autocorrelation. Point out that two data values, lagged by time (k-1)Δt are multiplies, and then all such data values are summed.
  12. The autocorrelation is itself a time series, where the interpretation of time is lag-time
  13. The formula for the autocorrelation is very similar to the formula for the convolution. Note that we have written an integral version, modeled after the integral version of the convolution. We use a five-pointed start to indicate autocorrelation, an asterisk to indicate convolution.
  14. The only difference is the sign.
  15. MatLab computes the autocorrelation with just one command.
  16. Because the formula for the autocorrelation is so similar to the formula for the convolution, there is a really simple relationship between the two.
  17. This is very similar to the convolution theorem.
  18. Ask the class to imagine the rain and discharge time series that correspond to this scenario.
  19. Here’s a hypothetical version.
  20. The peak in discharge is delayed behind the peak in rain.
  21. The shape of the two time series is not exactly the same. Rain tend to be spikier.
  22. Point out that the time series must be stationary for the covariance to depend only on the lag.
  23. autocorrelation is just a time-series cross-correlated with itself.
  24. We use a five-pointed start to indicate cross-correlation, an asterisk to indicate convolution.
  25. You might show on the board that if you set u=v=d, that is, use the same time series for both u and v, you get the rules that we worked out previously for the autocorrelation. Emphasize that autocorrelation is just a special case of cross-correlation.
  26. We will demonstrate one of the uses of the cross-spectral density when we talk about coherence.
  27. Cross-correlation is implemented with a single function, the same function as autocorrelation.
  28. In many cases, you want to know the delay of one time series behind another. Once you know the delay, you can plot the time series so that they are lined up.
  29. Point out that the two time series don’t have to be identical for this to work. The merely have to track each other approximately, once aligned: high values on average line up with high values. low values on average line up with low values.
  30. Point out the importance of testing a method with a “test” or “synthetic” dataset with known properties. Here the times series contain a simple oscillatory function with known time lags superimposed upon random noise.
  31. Here’s the cross-correlation, computed with the MatLab xcorr() function.
  32. It’s the time lag of the maximum that’s of interest.
  33. Here’s the MatLab script that computes the time lag needed to best-align the time series.
  34. Point out that it makes a difference whether you compute xcorr(u,v) or xcorr(v,u). One is the time-reversed version of the other.
  35. Remind students that the max() function returns both the value of the maximum and the index at which the maximum value occurs. In our case, it is the latter value, the lag, that is of interest.
  36. The zero-lag element is in the middle of the cross-correlation time series c, hence the somewhat complicated formula for the time lag.
  37. In this case the procedure recovers exactly the known time lag.
  38. Introduce this datset: (Top) Hourly solar radiation data, in W/m2, from West Point, NY, for fifteen days starting August 1, 1993. Point out that the energy delivered by the sun to the top of the atmosphere is 1366 W/m2. These values are somewhat less, presumably because the sun is not directly overhead at the latitude of NY, and because of shading by clouds. (Bottom) Hourly tropospheric ozone data, in parts per billion, from the same location and time period. Ask for a volunteer to describe what ozone is and why we care about it. The text provides this synopsis: We apply this technique to an air quality dataset, in which the objective is to understand the diurnal fluctuations of ozone (O3). Ozone is a highly reactive gas that occurs in small (parts per billion) concentrations in the earth’s atmosphere. Ozone in the stratosphere plays an important role in shielding the earth’s surface from ultraviolet (UV) light from the sun, for it is a strong UV absorber. But its presence in the troposphere at ground level is problematical. It is a major ingredient in smog and a health risk, increasing susceptibility to respiratory diseases. Tropospheric ozone has several sources, including chemical reactions between oxides of nitrogen and volatile organic compounds in the presence of sunlight and high temperatures. We thus focus on the relationship between ozone concentration and the intensity of sunlight (that is, of solar radiation). Note the strong diurnal periodicity in both time series. Peaks in the ozone lag peaks in solar radiation (see vertical line)
  39. Ask for a volunteer from the class to explain what ozone is and why we care about it. Ozone is produced by solar radiation interacting with the atmosphere. Ozone builds up during the course of the day, so its concentration lags sunlight (as quantified by solar insolation). Hourly solar radiation data, in W/m2, from West Point, NY, for fifteen days starting August 1, 1993. B) Hourly tropospheric ozone data, in parts per billion, from the same location and time period. Note the strong diurnal periodicity in both time series. Peaks in the ozone lag peaks in solar radiation (see vertical line)
  40. This is the same procedure as was applied to the synthetic data.
  41. The dotted curve is the “delagged” version of the ozone data. Point out that it now lines up pretty welll with the solar radiation.