Class Note for STAT 635 at OSU 07
Class Note for STAT 635 at OSU 07
Popular in Course
Popular in Department
This 12 page Class Notes was uploaded by an elite notetaker on Friday February 6, 2015. The Class Notes belongs to a course at Ohio State University taught by a professor in Fall. Since its upload, it has received 22 views.
Reviews for Class Note for STAT 635 at OSU 07
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 02/06/15
STATISTICS 635 SUMMER 2005 STAT635 LECTURE OUTLINE 3 When you truly see all fears and illusions vanish and the beauty of truth is revealed to you Unknown EXAMPLE OF R CODE FOR SIMULATING AN AR1 PROCESS Simulate an AR1 process of length 144 with phi 072 Xlt arimasimlistarc 072 n144 Let s have a plot of 2 panels high by 1 Also make the teXt 07 times smaller parmfrowc21CeXO7 Plot the resulting time series plotX Xlabquottimequot ylabquotAR1 processquot typequotlquot Calculate and plot the ACF acfX 410123 lllllll ARM process l l l l l l l l D In 4D EEI Eu lEIEI izu MEI time Series x in 06 lllll ACF STATISTICAL ANALYSIS OF TIME SERIES 1 STATISTICS 635 SUMMER 2005 MODELS WITH TREND AND SEASONAL COMPONENTS A GOOD PRACTICE IN TIME SERIES ANALYSIS D Step 1 Plot the data D Step 2 Investigate the existence of Q Apparent discontinuities such as sudden change in level or behavior C Could it be that the series needs to be broken into homogeneous segments C ls the variance increasing with time Q Outliers D Step 3 Perform any suitable transformation e g logarithm to stabilize the variance if the graph suggests that D Step 4 Inspect the graph to nd out if it suggests the possibility of representing the data as a realization of the classical decomposition model Xtmt8tYt 1 Where Q mt is the trend component d Q st Is a seasonal component With period d and 21st 0 Q Yt is a random noise component with 0 THE STANDARD PROCEDURE HAS TWO STEPS D Estimate and extract the deterministic components mt and st Q A popular model for st is the harmonic regression model k st Z Olj COSlt27Tfjtgt j sin27rfjt j1 C The Cg1 j 1 h are the parameters to be estimated C The fj control the frequency of the periodicity D Analyze the residual noise component Yt Q The aim is to hopefully model the residual Yt as a stationary time series STATISTICAL ANALYSIS OF TIME SERIES 2 STATISTICS 635 SUMMER 2005 A NONSEASONAL MODEL WITH TREND If our plot reveals no seasonal effect but does suggest the existence of a trend then we may use the simpler decomposition Xt mt Yr with 0 To construct a model for the data we consider two methods D METHOD 1 Trend estimation Q Fit a polynomial trend by Least squares regression Q Subtract the tted trend from the data Q Find an appropriate stationary time series model for the residuals D METHOD 2 Differencing Q Eliminate the trend directly by differencing Q Find an appropriate stationary time series model for the residuals Method 2 has the advantage that it typically uses fewer parameters and does not rest on the assumption that the trend remains the same throughout the observation time METHOD 12 TREND ESTIMATION BY LEAST SQUARES D A polynomial of degree k in t is posited as a model for mt ie mt 50 it 2t2 quot ktk k 51 j0 D The coe icients parameters are estimated by the least squares method ie nding those 53 that minimize the residual sum of squares n n k 2 R33 Z Xt mt2 Z X ZBjtj i1 2 1 D Computing In R this is done with the function lm Type helplm STATISTICAL ANALYSIS OF TIME SERIES 3 STATISTICS 635 SUMMER 2005 MORE ON LEAST SQUARES ESTIMATION OF TREND X17X27 39 quot 7XnT7 Y K7367 quot 39 71VTLl 7a11d39l 3 807817827 quot 39 78kT7 the model can be written in matrix form as XA6Y Where 1 t1 1 v2 A 1 tn t The ordinary least squares estimator of 6 is therefore I ATA 1ATX Remark Since the process is typically not an HD noise process the statistical properties of 6 will be different from the the results encountered in basic regression courses METHOD 1 APPLIED TO THE LAKE HURON DATA D The plot of the Lake Huron data set seemed to suggest a linear downward trend so that one could posit the following simple linear regression model mt 50 5115 B One could use the scaled index If 1 2 711 98 or the more meaningful original index If 1875 1876 7 1972 D Some of the R commands used dataLakeHuron Load the Lake Huron time series years lt 18751972 Create a variable named years lmhuronlt lmLakeHuron years Fit the linear regression model plotyearsLakeHuron type quotlquot Xlabquotyearquot ylabquotLevelquot ablinelmhuronlty2 Add the line to Huron plot acf residlmhuron Plot the ACF of the residuals STATISTICAL ANALYSIS OF TIME SERIES 4 STATISTICS 635 SUMMER 2005 D Some of the R commands used summarylmhuron Summarize the model obtained Call lmformula LakeHuron years Residuals Min 1Q Median 3Q MaX 2 509970 0 727260 0000829 0744024 2 535650 Coefficients Estimate Std Error t value Prgtt Intercept 625554918 7764293 80568 lt 2e16 years 0024201 0004036 5996 355e08 Signif codes 0 0001 001 005 01 1 Residual standard error 113 on 96 degrees of freedom Multiple R Squared 02725 Adjusted R squared 02649 F statistic 3595 on 1 and 96 DF p value 3545e 08 D Plot of trend and plot of sample ACF Series residlmhuron 582 I I n 581 I 550 I n e I 579 I mm m 221 Am B 4 I 578 I n 2 I 577 I n n 576 I an 2 I I I I I I I man man Ia2n 19m wen n In 2U an AD yea Lag D Judging from the ACF plot is an HD noise process realistic adequate for Yt in the Lake Huron data STATISTICAL ANALYSIS OF TIME SERIES 5 STATISTICS 635 SUMMER 2005 TREND ESTIMATION BY LINEAR FILTERING D General idea of moving average filtering Imagine an operator that for each point Xi in the time series constructs a corresponding point de ned as a weighted average of an in nite number of points around Xt X75 1 X7 Z antj j7oo Q The above is a moving average filter Q The coe icients aj de ne a filter Q The lter is de ned to remove the noise since it averages leaving the smooth part of the series which should be an estimate of the trend Q Different lters a will yield different transforms of the original series B Finite simple moving average filter Imagine the above idea applied locally with the weights a being all equal Clearly that means mapping each Xi to Wt where 1 4 W X 1lttlt n1 t qT n q 4 Q Finite because it is nite and simple because all the weights are equal 1 1 1 Q With that our lter is simply m m D Finite simple moving average filter for linear trend Q Assume that mt is approximately linear on the interval t qt q Q Assume also that the average of error terms is zero on t q t q ie 1 q Y1m0 2W M Q For the nonseasonal series with trend ie Xi mt Yt we have 1 q 1 4 W km I lt2q1gtZm2q1 mt Fit for q 1 S t S n q The moving thus provides us with trend estimates 1 q A X 1lttlt mt n1 t 11 q 7quot STATISTICAL ANALYSIS OF TIME SERIES 6 STATISTICS 635 SUMMER 2005 DEALING WITH BOUNDARY CONDITION D Xi is not observed for t S 0 or t gt 11 Therefore the above summation are not de ned for t S q or t gt n q E In practice one may set Xi X1 for t lt I and Xi Xn for t gt n MOVING AVERAGE FILTERING OF LAKE HURON SERIES dataLakeHuron Load the LakeHuron series 1h lt filter LakeHuron filterrep 111 1 1 For q 5 MA lter with q5 MA lter with q7 m I I I I I m I I I I I IEEEI IBUEI IBZEI IBAEI IBEEI IEEEI IBUEI IBZEI IBAEI IBEEI TIME TIME MA lter with q11 MA lter with q17 m I I I I I m I I I I I IEEEI IBUEI IBZEI IBAEI IBEEI IEEEI IBUEI IBZEI IBAEI IBEEI IIme IIme D Notice There is a bias variance tradeoff at play here Q As q increases the estimate of the trend has STATISTICAL ANALYSIS OF TIME SERIES 7 STATISTICS 635 SUMMER 2005 THE SPENCER 15 POINT MA FILTER D This speci c lter is de ned as aj 0 07a17a27a37a47a57a67a7 i746746213 5 6 3 320 with 0 1 07 gt 7 and ajaj E Special feature This lter passes through polynomials of degree 3 without distortion Q Provide an explanation in problem 12 EXPONENTIAL SMOOTHING D De nition For any xed oz 6 01 de ne m t 12 n mt OZXt1 Olmt1 t2737quot397n mt OZlt1 athj OZVTle t2 2 D Clearly that de nes a weighted moving average of Xi XtL1 D The moving is clearly one sided unlike the ones encountered earlier D The weights of are al ozj and since oz 6 0 1 these weights are decreasing exponentially except for the last one hence the term exponential smoothing STATISTICAL ANALYSIS OF TIME SERIES 8 STATISTICS 635 SUMMER 2005 METHOD 2 DIFFERENCING The method of elimination of trend by differencing makes use of the lag l differ ence operator V given by VXt Xi Xt1 1 BXt where B is the backward shift operator BX XH D Powers of B and V lntuitively meaning several recursive applications of the same operator 31th Xtij Vth VltVj71Xt Z l and VOXt X75 Q Treat then as polynomials Example Power 2 ngt WWX 1 B1 BX 1 2B 36X X 2Xt71 Xt72 D Clearly for Xi mt Yt with mt 2270 cjtj v IX kick v IY Q If is stationary with mean 0 then VkXt is a stationary process with mean kick Q Nice implication Given any series Xi one can keep on applying the lad 1 difference operator until one gets VkXt that is realistically stationary Q This is indeed reasonable since polynomials usually provide decent ap proximations for many functions D In R differencing is easily done by calling the function diff D Homework Exercise 5 Apply the differencing technique to the Lake Huron data plot the acf and comment STATISTICAL ANALYSIS OF TIME SERIES 9 STATISTICS 635 SUMMER 2005 ESTIMATION OF A SEASONAL MODEL WITH TREND D We now consider the model with both seasonal effect and trend Xtmt5tyt7 t1727quot397n with 0 and SHd 5t and 2151 0 D Step 1 Estimation of the trend by an MA lter of length d Q Ifd2ql then A 1 4 mt E Xtij 174 Q If d 2g then 1 4 1 17q1 D Step 2 Estimation of the seasonal component Q Suppose that n kd Q Compute the average of the deviations wkxkjd mkjd7 qltkden q Q Since these average deviations do not necessarily sum to zero the esti mate of 5k is d kwk d 1ZwZ k12 d 23971 and k kd for k gt d D Deseasonalize dtt t7 t1727 7 l L D Re estimate the trend from the deseasonalized data dt by tting a least squares polynomial trend m to dt D Extract an estimate of the noise series as follows YIxtmt5t7 t1727quot397n STATISTICAL ANALYSIS OF TIME SERIES 10 STATISTICS 635 SUMMER 2005 DIFFERENCING OF A SEASONAL MODEL WITH TREND D The lag d differencing operator vdX X XH 1 36X D With Xi mt st Yt where st has period d VdXt mt mtid Yt Ytid D So VdXt admits a decomposition into Q A trend component mt mpd Q A noise term Yt Kid U That s good news because D The trend mt mt7d can be eliminated using methods described earlier Q Application of power of the lag 1 difference operator V TESTING THE ESTIMATED NOISE SEQUENCE D For large n and an iid sequence Y1 Y2 Yn with nite variance the sample autocorrelations are approximately iid with distribution N0 1 D The Portmanteau test lts advantage over the HD test mentioned earlier is that here we get to use a single statistic h QnZ 2J Fiom the fact that N N01 forj 1 h it is clear that Q 26 Therefore reject the iid hypothesis at level oz if Q N X12Qh B Your responsibility is to read about the other techniques in Section 16 STATISTICAL ANALYSIS OF TIME SERIES 11 STATISTICS 635 SUMMER 2005 A TEST FOR IID NOISE USING THE SAMPLE ACF D Note For iid noise with nite variance we have for h y 0 pm N N lt0 D Steps of the diagnostic for iid noise Q Plot the lag h versus Q Draw two horizontal lines at ll96 C These two lines are drawn automatically m R Q You should have about 95 of the the values h 12 within the lines if the noise is indeed iid D Which of the following depicts an HD noise Series X Series X Ga 08 In 06 08 In I I ACF U 4 ACF U 4 I 02 an 02 I an What should we do when the noise process is found to be it39d STATISTICAL ANALYSIS OF TIME SERIES 12
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'