Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Ka-fu Wong University of Hong Kong Pulling Things Together.

Similar presentations


Presentation on theme: "1 Ka-fu Wong University of Hong Kong Pulling Things Together."— Presentation transcript:

1 1 Ka-fu Wong University of Hong Kong Pulling Things Together

2 2 Forecasting future values of the time series, Y. We want to forecast Y T+1,Y T+2,…,Y T+H based on a data sample, Y 1,…,Y T. Our starting point is to assume that Y t, t = 1,…,T+H can be modeled as (i.e., there is no seasonal component): Y t = T t + c t T t is the trend component of Y t, which we assume has the form: T t = β 0 + β 1 t + β 2 t 2 + … β s t s for some positive integer s. That is, we assume that the trend component of Y t can be modeled as a polynomial in t. The deviations from trend, c t, (which we also refer to as they cyclical component of Y t ) are assumed to be a zero-mean covariance stationary time series with an AR(p) representation, i.e., c t = φ 1 c t-1 + … + φ p c t-p + ε t where ε t ~ WN(0,σ 2 ) and the φ’s satisfy the stationarity condition.

3 3 Remarks Seasonal component We are assuming that Y t does not have a seasonal component. If Y t does have a seasonal component, S t, then we would have modeled Y as: Y t = T t + S t + c t S t may be modeled as “seasonal dummy variables”. Cyclical component In a more general model, c t may be modeled as ARMA(p,q) instead of AR(p), as discussed earlier.

4 4 Obtaining the point estimate The h-step ahead forecast of Y given information available at time T, Y T+h,T is: T T+h +c T+h,T = β 0 +β 1 (T+h)+...+β s (T+h) s + c T+h,T where c T+h,T is the h-step ahead forecast of c implied by the AR(p) model. In order to make these forecasts operational, we need to select s and p and then estimate the parameters, β 0,β 1,…,β s,φ 1,…,φ p in two steps. 1.Select s (AIC, SIC,…) 2.Estimate the β’s, which also yields estimates of c 1,…,c T : 3.Select p, using the c-hats in place of c’s (AIC, SIC,…) 4.Estimate the φ’s by fitting the c-hats to an AR(p) model.

5 5 Obtaining the forecast Intervals The 95-percent forecast interval for Y T+h will be Y T+h,T + 2σ h Where σ h is the standard error of the h-step ahead forecast. (90- percent, 99-percent and other forecast intervals can be constructed by replacing “2” with the appropriate percentile of the N(0,1) distribution).

6 6 The calculation of σ h : If we ignore the effects that parameter uncertainty contribute to forecast errors, the only source of forecast error will be the fundamental uncertainty associated with forecasting the cyclical component of Y (resulting from our inability to forecast ε T+1,..,ε T+H ). In this case, the formulas we discussed earlier can be used to estimate σ h. However, by ignoring parameter uncertainty, the resulting forecast intervals will be too small (i.e., the actual “coverage” of the intervals will be less than 95-percent).

7 7 The calculation of σ h : The forecast S.E.’s provided by EViews for y T+h,T, properly account for the fundamental uncertainty and parameter uncertainty associated with estimating the AR coefficients φ 1,…,φ p. So, they are more appropriate than the “simple” formulas for σ h discussed earlier. However, the EViews forecast S.E.s that are constructed through this approach only partially account for parameter uncertainty. They do not account for the errors associated with estimating the β’s in the trend component of the model.

8 8 A One-Step Approach to Forecasting Using the Trend-AR Model Assume, for convenience that Y t = β 0 + β 1 t + c t c t = φc t-1 + ε t, ε t ~ WN(0,σ2) i.e., a linear trend plus AR(1) model. Then – 1. φY t-1 = φ[β 0 + β 1 (t-1) + c t-1 ] = φβ 0 + φβ 1 (t-1) + φc t-1 2. Y t - φY t-1 = β 0 + β 1 t + c t – [φβ 0 + φβ 1 (t-1) + φc t-1 ] = [(1-φ)β 0 + φβ 1 ] + β 1 (1-φ)t + c t - φc t-1 =  0 +  1 t + ε t where  0 = (1-φ)β 0 + φβ 1,  1 = β 1 (1-φ)

9 9 A One-Step Approach to Forecasting Using the Trend-AR Model Hence, Y t =  0 +  1 t + φY t-1 + ε t Procedure: Estimate  0,  1, and φ Forecast Y T+1,…,Y T+H Y T+1 =  0 +  1 (T+1) + φY T + ε T+1 Y T+1,T =  0 +  1 (T+1) + φY T Y T+2 =  0 +  1 (T+2) + φY T+1 + ε T+2 Y T+2,T =  0 +  1 (T+2) + φY T+1,T … Y T+H,T =  0 +  1 (T+H) + φY T+H-1,T

10 10 In EViews After running the regression of Y on 1,t, and Y(-1), select “Forecast” from the regression output window. Note that the forecast standard errors that EViews computes will account for the parameter uncertainty regarding  0,  1, and φ (or, equivalently, β 0, β 1, and φ) rather than simply φ. Important: Your series t must include values for T+1,…,T+H for this to work.

11 11 The more general trend+ AR model. Y t = β 0 + β 1 t + … + β s t s + c t c t = φ 1 c t-1 + … + φ p c t-p + ε t implies Y t =  0 +  1 t+…+  s t s + φ 1 Y t-1 +…+ φ p Y t-p + ε t where the  ’s are functions of the β’s and φ’s. Given s and p – 1. Fit this model by OLS to estimate the  ’s and φ’s. 2. Generate Y T+h,T recursively according to Y T+h,T =  0 +  1 (T+h)+…+  s (T+h) s + φ 1 Y T+h-1,T +…+ φ p Y T+h-p,T where Y T+h-s,T = Y T+h-s if T+h-s < T.

12 12 In EViews After running the regression of Y on 1, t, and Y(-1),…,Y(-p), select “Forecast” from the regression output window. Note that the forecast standard errors that EViews will compute will account for the parameter uncertainty regarding  ’s and φ’s (or, equivalently, β’s, and φ) rather than simply φ’s. Important: Your series t must include values for T+1,…,T+H for this to work. How to select s and p? The same way as before (AIC, SIC…)

13 13 Full model

14 14 Forecast Forecast when the parameters have to be estimated: Forecast when the parameters are known:

15 15 Example: Forecasting Liquor Sales 1. Plot the data Observation #1: Seasonal pattern. Observation #2: an upward time trend, slightly nonlinear. Observation #3: Variance increasing over time.

16 16 2. Transform the data so that the variance appear stabilized. Use Log(x) in this case.

17 17 3. Estimate a simple model

18 18 Check the residuals

19 19 Check Autocorrelations

20 20 Check the partial autocorrelations

21 21 4. Revise the model

22 22 Check the residuals

23 23 Check the autocorrelations

24 24 Check the partial autocorrelations

25 25 5. Revise the model again

26 26 Check the residuals

27 27 Check the autocorrelations

28 28 Check the partial autocorrelations

29 29 Check the Ljung-Box Reject the null that the residuals are white noise

30 30 Check distribution of residuals (normal?)

31 31 6. 12-month-ahead forecast

32 32 12-month-ahead forecast with realization

33 33 60-month-ahead forecast

34 34 60-month-ahead forecast

35 35 Transform the forecast back exp(x)

36 36 Assessing Model Stability Using Recursive Estimation and Recursive Residuals Forecast: If the model’s parameters are different during the forecast period than they were during the sample period, then the model we estimated will not be very useful, regardless of how well it was estimated. Model: If the model’s parameters were unstable over the sample period, then model was not even a good representation of how the series evolved over the sample period.

37 37 Are the parameters constant over the sample? Consider the model of Y that combines the trend and AR(p) components into the following form: Y t =β 0 + β 1 t + β 2 t 2 +…+β s t s +φ 1 Y t-1 +…+φ p Y t-p +ε t where the ε’s are WN(0,σ 2 ). We will propose using results from applying the recursive estimation method to evaluate parameter stability over the sample period t = 1,…,T. Fit the model (by OLS) for t = p+1,…,T*, using increasing number of observations in each estimation. RegressionData used 1t= p+1, …, 2p+s+1 2t = p+1,…, 2p+s+2 3t = p+1,…, 2p+s+3 …… T-2p-st = p+1,…,T

38 38 Recursive estimation The recursive estimation yield parameter estimates for each T*: and for i = 1,..,s, j = 1,…,p and T* = 2p+s+1,…,T. If the model is stable over time then what we should find is that as T* increases the recursive parameter estimates should stabilize at some level. A model parameter is unstable if it does not appear to stabilize as T* increases or if there appears to be a sharp break in the behavior of the sequence before and after some T*.

39 39 Example: when parameters are stable Data plot Plot of recursive parameter estimates

40 40 Example: when there is a break in parameters Data plot Plot of recursive parameter estimates

41 41 Recursive Residuals and the CUSUM Test The CUSUM (“cumulative sum”) test is often used to test the null hypothesis of model stability, based on the residuals from the recursive estimates. The CUSUM statistic is calculated for each t. Under the null hypothesis of stability, the statistic follows the CUSUM distribution. If the calculated CUSUM statistics appear to be too large to have been drawn from the CUSUM distribution, we reject the null hypothesis (of model stability).

42 42 CUSUM Let e t+1,t denote the one-step-ahead forecast error associated with forecasting Y t+1 based on the model fit for over the sample period ending in period t. These are called the recursive residuals. e t+1,t = Y t+1 – Y t+1,t where the t subscripts on the estimated parameters refers to the fact that they were estimated based on a sample whose last observation was in period t. tt+1 t+2

43 43 CUSUM Let σ 1,t denote the standard error of the one-step ahead forecast of Y formed at time t, i.e, σ 1,t = sqrt(var(e t+1,t )) Define the standardized recursive residuals, w t+1,t, according to w t+1,t = e t+1,t /σ 1,t Fact: Under our maintained assumptions, including model homogeneity, w t+1,t ~ i.i.d. N(0,1). Note that there will be a set of standardized recursive residuals for each sample.

44 44 CUSUM The CUSUM (cumulative sum) statistics are defined according to: for t = k,k+1,…,T-1, where k = 2p+s+1 is the minimum sample size for which we can fit the model. Under the null hypothesis, the CUSUM t statistic is drawn from a CUSUM(t-k) distribution. The CUSUM(t-k) distribution is a symmetric distribution centered at 0. Its dispersion increases as t-k increases. We reject the null hypothesis at the 5% significance level if CUSUM t is below the 2.5-percentile or above the 97.5-percentile of the CUSUM(t-k) distribution.

45 45 Example: when parameters are stable

46 46 Example: when there is a break in parameters

47 47 Accounting for a structural break Suppose it is known that there is a structural break in the trend of a series in 1998 – due to Asian Financial Crisis.

48 48 Structural Breaks in the Trend Suppose that the trend in y t can be modeled as T t =  0,t +  1,t t where  0,t =  0,1 if t < T 0 (T 0 <T) =  0,2 if t > T 0 and  1,t =  1,1 if t < T 0 =  1,2 if t > T 0 In this case, T T+h =  0,2 +  1,2 (T+h) Problem – How to estimate  0,2 and  1,2 ? A bad approach – Regress y t on 1,t for t=1,…,T Y t =  0,2 +  1,2 t +  t

49 49 Better approaches – Regress y t on 1,t for t = T 0 +1,…,T Problems with this approach – Not an ideal approach if you want to force either the intercept or slope coefficient to be fixed over the full sample, t = 1,…,T, allowing only one of the coefficients to change at T 0. Does not allow you to test whether the intercept and/slope changed at T 0. Does not provide us with estimated deviations from trend for t = 1,…,T 0, which we will want to use to estimate the seasonal and cyclical components of the series to help us forecast those components of the series.

50 50 Better approaches Introduce dummy variables into the regression to jointly estimate  0,1,  0,2,  1,1,  1,2 Let D t = 0 if t = 1,…,T 0 =1 if t > T 0 Run the regression over the full sample y t =  0 +  1 D t +  2 t +  3 (D t t) +  t, t = 1,…,T. Then Suppose we want to allow  0 to change at T 0 but we want to force  1 to remain fixed (i.e., a shift in the intercept of the trend line) – Run the regression of y t on 1, D t and t to estimate  0,  1, and  2 ( =  1 ).

51 51 Remarks This approach extends to higher order polynomials in a straightforward way, allowing one or more parameters to change at one or more points in time. This approach can be extended to allow for breaks at unknown time(s).

52 52 The Liquor sales example again Recursive residuals

53 53 Look at the parameter estimates from recursive regressions

54 54 Look at the parameter estimates from recursive regressions

55 55 Look at the parameter estimates from recursive regressions

56 56 Check Cusum

57 57 End


Download ppt "1 Ka-fu Wong University of Hong Kong Pulling Things Together."

Similar presentations


Ads by Google