# Environmental Data Analysis with MatLab Lecture 17: Covariance and Autocorrelation.

## Presentation on theme: "Environmental Data Analysis with MatLab Lecture 17: Covariance and Autocorrelation."— Presentation transcript:

Environmental Data Analysis with MatLab Lecture 17: Covariance and Autocorrelation

Lecture 01Using MatLab Lecture 02Looking At Data Lecture 03Probability and Measurement Error Lecture 04Multivariate Distributions Lecture 05Linear Models Lecture 06The Principle of Least Squares Lecture 07Prior Information Lecture 08Solving Generalized Least Squares Problems Lecture 09Fourier Series Lecture 10Complex Fourier Series Lecture 11Lessons Learned from the Fourier Transform Lecture 12Power Spectral Density Lecture 13Filter Theory Lecture 14Applications of Filters Lecture 15Factor Analysis Lecture 16Orthogonal functions Lecture 17Covariance and Autocorrelation Lecture 18Cross-correlation Lecture 19Smoothing, Correlation and Spectra Lecture 20Coherence; Tapering and Spectral Analysis Lecture 21Interpolation Lecture 22 Hypothesis testing Lecture 23 Hypothesis Testing continued; F-Tests Lecture 24 Confidence Limits of Spectra, Bootstraps SYLLABUS

purpose of the lecture apply the idea of covariance to time series

Part 1 correlations between random variables

Atlantic Rock Dataset Scatter plot of TiO 2 and Na 2 O TiO 2 Na 2 O

TiO 2 Na 2 O d1d1 d2d2 scatter plot idealization as a p.d.f.

d1d1 d2d2 positive correlation d1d1 d2d2 d1d1 d2d2 negative correlation uncorrelated types of correlations

the covariance matrix C = σ12σ12 σ22σ22 σ 1,2 σ32σ32 … σ 1,3 σ 2,3 σ 1,2 σ 2,3 σ 1,3 … … … … … …

recall the covariance matrix C = σ12σ12 σ22σ22 σ 1,2 σ32σ32 … σ 1,3 σ 2,3 σ 1,2 σ 2,3 σ 1,3 … … … … … … covariance of d 1 and d 2

estimating covariance from data

didi djdj didi djdj bin, s divide (d i, d j ) plane into bins

didi djdj didi djdj bin, s with N s data estimate total probability in bin from the data: P s = p(d i, d j ) Δd i Δd j ≈ N s /N

approximate integral with sum and use p(d i, d j ) Δd i Δd j ≈N s /N

shrink bins so no more than one data point in each bin

“sample” covariance

normalize to range ± 1 “sample” correlation coefficient

R ij -1 perfect negative correlation 0 no correlation 1 perfect positive correlation

SiO 2 TiO 2 Al 2 O 2 FeO MgO CaO Na 2 O K2OK2O SiO 2 TiO 2 Al 2 O 2 FeOMgOCaONa 2 OK2OK2O |R ij | of the Atlantic Rock Dataset

SiO 2 TiO 2 Al 2 O 2 FeO MgO CaO Na 2 O K2OK2O SiO 2 TiO 2 Al 2 O 2 FeOMgOCaONa 2 OK2OK2O |R ij | of the Atlantic Rock Dataset 0.73

Atlantic Rock Dataset Scatter plot of TiO 2 and Na 2 O TiO 2 Na 2 O

Part 2 correlations between samples within a time series

A) time series, d(t) time t, days d(t), cfs Neuse River Hydrograph

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

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

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

A) time series, d(t) time t, days d(t), cfs Neuse River Hydrograph

1 day3 days30 days

Let’s assume different samples in time series are random variables and calculate their covariance

usual formula for the covariance assuming time series has zero mean

now assume that the time series is stationary (statistical properties don’t vary with time) so that covariance depends only on time lag between samples

time series of length N time lag of (k-1)Δt

1 using the same approximation for the sample covariance as before

1 autocorrelation at lag (k-1)Δt

autocorrelation in MatLab

Autocorrelation on Neuse River Hydrograph

symmetric about zero a point in a time series correlates equally well with another in the future and another in the past

Autocorrelation on Neuse River Hydrograph peak at zero lag a point in time series is perfectly correlated with itself

Autocorrelation on Neuse River Hydrograph falls off rapidly in the first few days lags of a few days are highly correlated because the river drains the land over the course of a few days

Autocorrelation on Neuse River Hydrograph negative correlation at lag of 182 days points separated by a half year are negatively correlated

Autocorrelation on Neuse River Hydrograph positive correlation at lag of 360 days points separated by a year are positively correlated

A) B) Autocorrelation on Neuse River Hydrograph repeating pattern the pattern of rainfall approximately repeats annually

autocorrelation similar to convolution

note difference in sign

Important Relation #1 autocorrelation is the convolution of a time series with its time-reversed self

integral form of autocorrelation

change of variables, t’=-t

integral form of autocorrelation change of variables, t’=-t write as convolution

Important Relationship #2 Fourier Transform of an autocorrelation is proportional to the Power Spectral Density of time series

so since

so since

so since Fourier Transform of a convolution is product of the transforms

so since Fourier Transform of a convolution is product of the transforms Fourier Transform integral

so since Fourier Transform of a convolution is product of the transforms Fourier Transform integral transform of variables, t’=-t

so since Fourier Transform of a convolution is product of the transforms Fourier Transform integral transform of variables, t’=-t symmetry properties of Fourier Transform

Summary time lag 0 frequency0 rapidly fluctuating time series narrow autocorrelation function wide spectrum

Summary time lag 0 frequency0 slowly fluctuating time series wide autocorrelation function narrow spectrum

Download ppt "Environmental Data Analysis with MatLab Lecture 17: Covariance and Autocorrelation."

Similar presentations