1 Fourier Series (Spectral) Analysis. 2 Fourier Series Analysis Suitable for modelling seasonality and/or cyclicalness Identifying peaks and troughs.

Slides:



Advertisements
Similar presentations
A. The Basic Principle We consider the multivariate extension of multiple linear regression – modeling the relationship between m responses Y 1,…,Y m and.
Advertisements

Introduction to Predictive Modeling with Examples Nationwide Insurance Company, November 2 D. A. Dickey.
Lecture 15 Orthogonal Functions Fourier Series. LGA mean daily temperature time series is there a global warming signal?
Experimental design and analyses of experimental data Lesson 2 Fitting a model to data and estimating its parameters.
GG 313 Lecture 25 Transform Pairs and Convolution 11/22/05.
Physics 1251 The Science and Technology of Musical Sound Unit 1 Session 8 Harmonic Series Unit 1 Session 8 Harmonic Series.
DFT/FFT and Wavelets ● Additive Synthesis demonstration (wave addition) ● Standard Definitions ● Computing the DFT and FFT ● Sine and cosine wave multiplication.
Math Review with Matlab:
Analysis of Variance Compares means to determine if the population distributions are not similar Uses means and confidence intervals much like a t-test.
Regression Analysis Once a linear relationship is defined, the independent variable can be used to forecast the dependent variable. Y ^ = bo + bX bo is.
Linear regression models
EPI 809/Spring Probability Distribution of Random Error.
Topic 3: Simple Linear Regression. Outline Simple linear regression model –Model parameters –Distribution of error terms Estimation of regression parameters.
Some Terms Y =  o +  1 X Regression of Y on X Regress Y on X X called independent variable or predictor variable or covariate or factor Which factors.
Multiple regression analysis
Matrix A matrix is a rectangular array of elements arranged in rows and columns Dimension of a matrix is r x c  r = c  square matrix  r = 1  (row)
Reading – Linear Regression Le (Chapter 8 through 8.1.6) C &S (Chapter 5:F,G,H)
Signals Processing Second Meeting. Fourier's theorem: Analysis Fourier analysis is the process of analyzing periodic non-sinusoidal waveforms in order.
CHAPTER 16 Fourier Series.
Example: Price Analysis for Diamond Rings in Singapore Variables Response Variable: Price in Singapore dollars (Y) Explanatory Variable: Weight of diamond.
Statistical Forecasting Models
This Week Continue with linear regression Begin multiple regression –Le 8.2 –C & S 9:A-E Handout: Class examples and assignment 3.
Topic 16: Multicollinearity and Polynomial Regression.
Topic 28: Unequal Replication in Two-Way ANOVA. Outline Two-way ANOVA with unequal numbers of observations in the cells –Data and model –Regression approach.
© 2002 Prentice-Hall, Inc.Chap 14-1 Introduction to Multiple Regression Model.
Topic 2: An Example. Leaning Tower of Pisa Construction began in 1173 and by 1178 (2 nd floor), it began to sink Construction resumed in To compensate.
1 Experimental Statistics - week 10 Chapter 11: Linear Regression and Correlation.
23-1 Analysis of Covariance (Chapter 16) A procedure for comparing treatment means that incorporates information on a quantitative explanatory variable,
Topic 7: Analysis of Variance. Outline Partitioning sums of squares Breakdown degrees of freedom Expected mean squares (EMS) F test ANOVA table General.
Lecture 4 SIMPLE LINEAR REGRESSION.
Module 2 SPECTRAL ANALYSIS OF COMMUNICATION SIGNAL.
Wireless and Mobile Computing Transmission Fundamentals Lecture 2.
Topic 14: Inference in Multiple Regression. Outline Review multiple linear regression Inference of regression coefficients –Application to book example.
6-3 Multiple Regression Estimation of Parameters in Multiple Regression.
Regression Examples. Gas Mileage 1993 SOURCES: Consumer Reports: The 1993 Cars - Annual Auto Issue (April 1993), Yonkers, NY: Consumers Union. PACE New.
Regression For the purposes of this class: –Does Y depend on X? –Does a change in X cause a change in Y? –Can Y be predicted from X? Y= mX + b Predicted.
Testing Multiple Means and the Analysis of Variance (§8.1, 8.2, 8.6) Situations where comparing more than two means is important. The approach to testing.
Case Studies in Time Series II Periodic Behavior and Related issues David A. Dickey Professor of Statistics N. C. State University.
Xuhua Xia Polynomial Regression A biologist is interested in the relationship between feeding time and body weight in the males of a mammalian species.
Why Design? (why not just observe and model?) CopyrightCopyright © Time and Date AS / Steffen Thorsen All rights reserved. About us | Disclaimer.
Topic 17: Interaction Models. Interaction Models With several explanatory variables, we need to consider the possibility that the effect of one variable.
Inference for Regression Simple Linear Regression IPS Chapter 10.1 © 2009 W.H. Freeman and Company.
6-1 Introduction To Empirical Models Based on the scatter diagram, it is probably reasonable to assume that the mean of the random variable Y is.
The Completely Randomized Design (§8.3)
6-3 Multiple Regression Estimation of Parameters in Multiple Regression.
Topic 13: Multiple Linear Regression Example. Outline Description of example Descriptive summaries Investigation of various models Conclusions.
Fourier series: Eigenfunction Approach
1 Experimental Statistics - week 14 Multiple Regression – miscellaneous topics.
Periodic driving forces
By: Corey T. Williams 03 May Situation Objective.
ANOVA: Graphical. Cereal Example: nknw677.sas Y = number of cases of cereal sold (CASES) X = design of the cereal package (PKGDES) r = 4 (there were 4.
Simple Linear Regression. Data available : (X,Y) Goal : To predict the response Y. (i.e. to obtain the fitted response function f(X)) Least Squares Fitting.
1 Experimental Statistics - week 12 Chapter 12: Multiple Regression Chapter 13: Variable Selection Model Checking.
1 Experimental Statistics - week 9 Chapter 17: Models with Random Effects Chapter 18: Repeated Measures.
Sinusoid Seventeenth Meeting. Sine Wave: Amplitude The amplitude is the maximum displacement of the sine wave from its mean (average) position. Simulation.
Topic 24: Two-Way ANOVA. Outline Two-way ANOVA –Data –Cell means model –Parameter estimates –Factor effects model.
1 Experimental Statistics Spring week 6 Chapter 15: Factorial Models (15.5)
Topic 20: Single Factor Analysis of Variance. Outline Analysis of Variance –One set of treatments (i.e., single factor) Cell means model Factor effects.
1 Chapter 5 : Volatility Models Similar to linear regression analysis, many time series exhibit a non-constant variance (heteroscedasticity). In a regression.
1 Statistics 262: Intermediate Biostatistics Regression Models for longitudinal data: Mixed Models.
1 Experimental Statistics - week 13 Multiple Regression Miscellaneous Topics.
Experimental Statistics - week 9
Periodic signals To search a time series of data for a sinusoidal oscillation of unknown frequency  : “Fold” data on trial period P  Fit a function.
Forecasting is the art and science of predicting future events.
1 Experimental Statistics - week 8 Chapter 17: Mixed Models Chapter 18: Repeated Measures.
1 Experimental Statistics - week 12 Chapter 11: Linear Regression and Correlation Chapter 12: Multiple Regression.
ELECTRIC CIRCUITS EIGHTH EDITION JAMES W. NILSSON & SUSAN A. RIEDEL.
The “Big Picture” (from Heath 1995). Simple Linear Regression.
CHAPTER 29: Multiple Regression*
Presentation transcript:

1 Fourier Series (Spectral) Analysis

2 Fourier Series Analysis Suitable for modelling seasonality and/or cyclicalness Identifying peaks and troughs

3 A sine wave is a repeating pattern that goes through one cycle every 2  (i.e. 2  = ) units of time. For example, X Y = sin (x)010– 10

4 So sin ( x) = sin (x)

5 Since Wave Phase Shifts Y = sin (x) Z = sin (x ) 0.5  (phase shift)

6 Amplitude Y = 25 sin (x) Amplitude

7 Combining Amplitude, Phase, Frequency and Wavelength Y t = A*sin(2  ft +  ) where t=Time (i.e., 1, 2, 3, …, n) Y t =Value of time series at time t A=Amplitude f=Number of cycle per observation n=Number of observations in time series 2  =one complete cycle  =Phase shift

8 Amplitude determines the heights of peaks and depths of troughs Phase shift determines where the peaks and troughs occur Let be the wavelength, i.e. the number of periods from the beginning of one cycle to the next.

9 0 0n n 

10 SeriesAfPnL Z3004/ Y2004/

11

12 How to fit a single sine wave to a time series? Consider the following data set: Year Quarter n = 20 Assume one cycle completes itself every year, then f = 5/20 and L = 4

13 So the model is : This equation cannot be estimated by standard techniques.

14 But note that

15

16 So the model becomes: tYtYt –

17 data fourier1; input y cards; ;run; data fourier2; set fourier1; pi= ; t+1; s5=sin(pi*t/2); c5=cos(pi*t/2); run; proc reg data=fourier2; model y = s5 c5; output out=out1 predicted=p residual=r; run; proc print data=out1; var y p r; run;

18 The SAS System The REG Procedure Model: MODEL1 Dependent Variable: y Number of Observations Read20 Number of Observations Used20 Analysis of Variance SourceDFSum of SquaresMean SquareF ValuePr > F Model <.0001 Error Corrected Total Root MSE R-square Dependent Mean Adj R-Sq Coeff Var Parameter Estimates VariableDFParameter EstimateStandard Errort Value Pr >  t  Intercept <.0001 S <.0001 C

19 The SAS System Obsyp r – – – – – – – – – – – MAPE = 8.525%

20

21 Fitting a set of sine waves to a time series Amplitudes of peaks and troughs are rarely equal General Fourier series model: So, the general model is a linear combination of cycles at the “harmonic” frequencies, each with its amplitude (A j ) and phase shift (P j )

22 Assume n is even The highest harmonic, h, is if n is even and (n-1)/2 if n is odd. Harmonic, j Harmonic Frequency, Wavelength,

23 Note that when, and So,

24 The General Fourier series model contains n unknowns to be estimated with n observations, i.e. no degree of freedom !! The idea is NOT to use the General Fourier Series model for forecasting, but to use it for identifying significant cycles.

25 data fourier3; set fourier1; pi= ; t+1; s1=sin (pi*t/10); c1=cos (pi*t/10); s2=sin (pi*t/5); c2=cos (pi*t/5); s3=sin (3*pi*t/10); c3=cos (3*pi*t/10); s4=sin (2*pi*t/5); c4=cos (2*pi*t/5); s5=sin (pi*t/2); c5=cos (pi*t/2); s6=sin (3*pi*t/5); c6=cos (3*pi*t/5); s7=sin (7*pi*t/10); c7=cos (7*pi*t/10); s8=sin (4*pi*t/5); c8=cos (4*pi*t/5); s9=sin (9*pi*t/10); c9=cos (9*pi*t/10); s10=sin (pi*t); c10=cos (pi*t); run;

26 proc reg data=fourier3; model y = s1 c1 s2 c2 s3 c3 s4 c4 s5 c5 s6 c6 s7 c7 s8 c8 s9 c9 c10; output out=out1 predicted=p residual=r; run; proc print data=out1; var y p r; run; proc spectra data=fourier1 out=out2; var y; run; data out2; set out2; sq=p_01; if period=. or period=4 then sq=0; if round (freq,.0001)= then sq=.5*p_01; run; proc print data=out2; sum sq; run;

27 The SAS System The REG Procedure Model: MODEL1 Dependent Variable: y Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance SourceDFSum of SquaresMean SquareF ValuePr > F Model Error00. Corrected Total Root MSE.R-Square Dependent Mean Adj R-Sq. Coeff Var.

28 Parameter Estimates VariableDFParameter Estimate Standard Errort Value Pr > ︳ t ︱ Intercept s c s c s c s c s c s c s c s c s c c

29 The SAS System Obsypr E E E E E E E E E E E E E E E E E E E E - 17

30 The SAS System ObsFREQPERIODP_01sq

31 So,

32 The Line Spectrum (Periodogram) To identify significant cyclical patterns. The Line Spectrum is the amount of total sums of squares explained by the specific frequencies.

33 Line Spectrum can be computed as The plot of P j ’s versus the wave length is called the periodogram. It measures the “intensity” of the specific cycles. The “P_01” column in SAS output gives the line spectrums for all harmonics, except for the last harmonic, where the correct line spectrum is P_01/2.

34

35 SourceSSdfFDecision 5 th harmonic Other harmonics Significant 10 th harmonic Other harmonics Significant 7 th harmonic Other harmonics Significant at 5% ; not significant at 1% 4 th harmonic Other harmonics not significant ANOVA test

36 Thus, the 5 th & 10 th harmonics (or equivalently, the 4- period & 2-period cycles) are significant which means a suitable model would be or equivalently,

37 Note: since and

38 The SAS System The REG Procedure Model: MODEL1 Dependent Variable: y Number of Observations Read 20 Number of Observations Used 20 Analysis of Variance SourceDFSum of SquaresMean SquareF ValuePr > F Model <.0001 Error Corrected Total Root MSE R-Square Dependent Mean Adj R-Sq Coeff Var Parameter Estimates VariableDFParameter EstimateStandard Errort Value Pr > ︳ t ︱ Intercept <.0001 s <.0001 c c <.0001

39 The SAS System Obsypr MAPE = 4.113%

40 Out-of-Sample forecasts

41 Example: U.S./New Zealand foreign Exchange Rate (1986 Q2 to 2008 Q2) Quarterly average

42 data Nzea; set Nzea; D_USNEWZD =USNEWZD - lag(USNEWZD); if Date = “Q2 1986” then delete; run; data Nzea; set Nzea; t+1; pi= ; s1= sin(pi*t/44*1); c1= cos(pi*t/44*1);. c43= cos(pi*t/44*43); s44= sin(pi*t/44*44); c44= cos(pi*t/44*44); run;

43 proc reg data= Nzea; model D_USNEWZD = s1 c1 s2 c2 s3 c3 s4 c4 s5 c5 s6 c6 s7 c7 s8 c8 s9 c9 s10 c10 s11 c11 s12 c12 s13 c13 s14 c14 s15 c15 s16 c16 s17 c17 s18 c18 s19 c19 s20 c20 s21 c21 s22 c22 s23 c23 s24 c24 s25 c25 s26 c26 s27 c27 s28 c28 s29 c29 s30 c30 s31 c31 s32 c32 s33 c33 s34 c34 s35 c35 s36 c36 s37 c37 s38 c38 s39 c39 s40 c40 s41 c41 s42 c42 s43 c43 c44 ; output out=out1 predicted=p residual=r; run; quit; proc spectra data= Nzea out=out2; var D_USNEWZD; run; data out2; set out2; sq=p_01; if period=. then sq=0; if round (freq,.0001)= then sq=.5*p_01; run; proc reg data= Nzea outest=outtest3; model D_USNEWZD = c31 s31 c3 s3 c8 s8 ; output out=out3 predicted=p residual=r; run; quit;

44 ANOVA test SourceSSdfFDecision 31st harmonic Significant Other harmonics rd harmonic Significant Other harmonics th harmonic Significant Other harmonics th harmonic Insignificant Other harmonics

45 Fitted model equation Forecasts