1 Econ 240 C Lecture 3. 2 3 4 5 6 1 White noise inputoutput 1/(1 – z) White noise input output...

Post on 19-Dec-2015

215 views 0 download

Tags:

transcript

11

Econ 240 CEcon 240 C

Lecture 3Lecture 3

22

33

44

55

66

1

White noiseWhite noise

inputoutput

1/(1 – z)

White noise

inputoutput

Random walk

SynthesisSynthesis

1/(1 – bz)

White noise

inputoutput

First order autoregressive

77

Simulated Random walkSimulated Random walk

• Eviews, sample 1 1000, gen wn = nrnd

• EViews, sample 1 1, gen rw = wn

• Sample 2 1000, gen rw = rw(-1) + wn

88

-40

-30

-20

-10

0

10

20

30

200 400 600 800 1000

RW WN

99

Simulated First Order Simulated First Order Autoregressive Process Autoregressive Process

• Eviews, sample 1 1000, gen wn = nrnd

• EViews, sample 1 1, gen arone = wn

• Sample 2 1000, gen arone = b*arone(-1) + wn

1010

SystematicsSystematics

• b =1, random walk

• b = 0.9

• b = 0.5

• b = 0.1

• b = 0, white noise

1111

-8

-6

-4

-2

0

2

4

6

8

200 400 600 800 1000

ARONE

arone = 0.9*arone(-1) + wn

Arone(t) = 0.9*arone(t-1) = wn(t)Arone(t) = 0.9*arone(t-1) = wn(t)

1212

Arone(t) = 0.5*arone(t-1) + wn(t)Arone(t) = 0.5*arone(t-1) + wn(t)

-6

-4

-2

0

2

4

6

200 400 600 800 1000

ARONE

arone = 0.5*arone(-1) + wn

1313

Arone(t) = 0.1*arone(t-1) + wn(t)Arone(t) = 0.1*arone(t-1) + wn(t)

-4

-2

0

2

4

200 400 600 800 1000

ARONE

arone = 0.1*aronne(-1) + wn

1414

Moving AveragesMoving Averages

1515

BloombergBloomberg

1616

1717

1818

Time Series ConceptsTime Series Concepts

• Analysis and Synthesis

1919

AnalysisAnalysis

• Model a real time seies in terms of its components

2020

Total Returns to Standard and Total Returns to Standard and Poors 500, Monthly, 1970-2003Poors 500, Monthly, 1970-2003

0

1000

2000

3000

4000

5000

70 75 80 85 90 95 00

SPRETURN

Total Returns for the Standard and Poors 500

Source: FRED http://research.stlouisfed.org/fred/

2121

Trace of ln S&P 500(t) Trace of ln S&P 500(t)

4

5

6

7

8

9

0 100 200 300 400 500

TIME

LNS

P50

0

Logarithm of Total Returns to Standard & Poors 500

2222

ModelModel

• Ln S&P500(t) = a + b*t + e(t)

• time series = linear trend + error

2323

Dependent Variable: LNSP500Method: Least SquaresSample(adjusted): 1970:01 2003:02Included observations: 398 after adjusting endpoints

Variable Coefficient Std. Error t-Statistic Prob.

C 4.049837 0.022383 180.9370 0.0000TIME 0.010867 9.76E-05 111.3580 0.0000

R-squared 0.969054 Mean dependent var 6.207030 Adjusted R-squared 0.968976 S.D. dependent var 1.269965 S.E. of regression 0.223686 Akaike info criterion -0.152131 Sum squared resid 19.81410 Schwarz criterion -0.132098 Log likelihood 32.27404 F-statistic 12400.61Durbin-Watson stat 0.041769 Prob(F-statistic) 0.000000

-0.6

-0.4

-0.2

0.0

0.2

0.4

0.6

70 75 80 85 90 95 00

ERROR

0

10

20

30

40

-0.50 -0.25 0.00 0.25 0.50

Series: ResidualsSample 1970:01 2003:02Observations 398

Mean 2.59E-15Median -0.036203Maximum 0.478857Minimum -0.494261Std. Dev. 0.223405Skewness 0.419110Kurtosis 2.377547

Jarque-Bera 18.07682Probability 0.000119

2626

Time Series Components ModelTime Series Components Model

• Time series = trend + cycle + seasonal + error

• two components, trend and seasonal, are time dependent and are called non-stationary

2727

SynthesisSynthesis

• The Box-Jenkins approach is to start with the simplest building block to a time series, white noise and build from there, or synthesize.

• Non-stationary components such as trend and seasonal are removed by differencing

2828

First DifferenceFirst Difference

• Lnsp500(t) - lnsp500(t-1) = dlnsp500(t)

-0.3

-0.2

-0.1

0.0

0.1

0.2

70 75 80 85 90 95 00

DLNSP500

0

20

40

60

80

100

-0.2 -0.1 0.0 0.1

Series: DLNSP500Sample 1970:02 2003:02Observations 397

Mean 0.008625Median 0.011000Maximum 0.155371Minimum -0.242533Std. Dev. 0.045661Skewness -0.614602Kurtosis 5.494033

Jarque-Bera 127.8860Probability 0.000000

3131

4.0

4.4

4.8

5.2

5.6

6.0

75 80 85 90 95 00

LNDNSROTM

Log of Rotterdam Inport Price: Dark Northern Spring

3232

-0.3

-0.2

-0.1

0.0

0.1

0.2

0.3

75 80 85 90 95 00

DLNDNSROTM

First Difference in Log of Rotterdam Import Price: Dark Northern Spring

3333

0

20

40

60

80

100

120

-0.2 -0.1 0.0 0.1 0.2 0.3

Series: DLNDNSROTMSample 1971:08 2001:12Observations 365

Mean 0.002290Median 0.000000Maximum 0.277165Minimum -0.244453Std. Dev. 0.052324Skewness 0.141729Kurtosis 7.454779

Jarque-Bera 303.0323Probability 0.000000

Histogram: First Difference of Log of Rotterdam Import Price, DNS

3434

Time seriesTime series

• A sequence of values indexed by time

3535

Stationary time seriesStationary time series

• A sequence of values indexed by time where, for example, the first half of the time series is indistinguishable from the last half

3636

Stochastic Stationary Time Stochastic Stationary Time SeriesSeries

• A sequence of random values, indexed by time, where the time series is not time dependent

3737

Summary of ConceptsSummary of Concepts

• Analysis and Synthesis

• Stationary and Evolutionary

• Deterministic and Stochastic

• Time Series Components Model

3838

White Noise SynthesisWhite Noise Synthesis

• Eviews: New Workfile– undated 1 1000

• Genr wn = nrnd

• 1000 observations N(0,1)

• Index them by time in the order they were drawn from the random number generator

-4

-2

0

2

4

200 400 600 800 1000

WN

-4

-3

-2

-1

0

1

2

3

10 20 30 40 50 60 70 80 90 100

WN

0

20

40

60

80

100

120

-3 -2 -1 0 1 2 3

Series: WNSample 1 1000Observations 1000

Mean 0.002336Median 0.017618Maximum 2.967726Minimum -3.713726Std. Dev. 0.992117Skewness -0.099788Kurtosis 2.973119

Jarque-Bera 1.689727Probability 0.429616

4242

SynthesisSynthesis• Random Walk

• RW(t) -RW(t-1) = WN(t) = dRW(t)

• or RW(t) = RW (t-1) + WN(t)

• lag by one: RW(t-1) = RW(t-2) + WN(t-1)

• substitute: RW(t) = RW(t-2) + WN(t) + WN(t-1)

• continue with lagging and substitutingRW(t) = WN(t) + WN (t-1) + WN (t-2) + ...

4343

Part IPart I

• Modeling Economic Time Series

4444

Total Returns to Standard and Total Returns to Standard and Poors 500, Monthly, 1970-2003Poors 500, Monthly, 1970-2003

0

1000

2000

3000

4000

5000

70 75 80 85 90 95 00

SPRETURN

Total Returns for the Standard and Poors 500

Source: FRED http://research.stlouisfed.org/fred/

4545

Analysis (Decomposition)Analysis (Decomposition)

• Lesson one: plot the time series

4646

Model One: Random WalksModel One: Random Walks

• we can characterize the logarithm of total returns to the Standard and Poors 500 as trend plus a random walk.

• Ln S&P 500(t) = trend + random walk = a + b*t + RW(t)

4747

Trace of ln S&P 500(t) Trace of ln S&P 500(t)

4

5

6

7

8

9

0 100 200 300 400 500

TIME

LNS

P50

0

Logarithm of Total Returns to Standard & Poors 500

4848

Analysis(Decomposition)Analysis(Decomposition)

• Lesson one: Plot the time series

• Lesson two: Use logarithmic transformation to linearize

4949

Ln S&P 500(t) = trend + RW(t)Ln S&P 500(t) = trend + RW(t)

• Trend is an evolutionary process, i.e. depends on time explicitly, a + b*t, rather than being a stationary process, i. e. independent of time

• A random walk is also an evolutionary process, as we will see, and hence is not stationary

5050

Model One: Random WalksModel One: Random Walks

• This model of the Standard and Poors 500 is an approximation. As we will see, a random walk could wander off, upward or downward, without limit.

• Certainly we do not expect the Standard and Poors to move to zero or into negative territory. So its lower bound is zero, and its model is an approximation.

5151

Model One: Random WalksModel One: Random Walks

• The random walk model as an approximation to economic time series– Stock Indices– Commodity Prices– Exchange Rates

5252

Model Two: White NoiseModel Two: White Noise

• we saw that the difference in a random walk was white noise.

)()( tWNtRW

5353

Model Two: White NoiseModel Two: White Noise

• How good an approximation is the white noise model?

• Take first difference of ln S&P 500(t) and plot it and look at its histogram.

5454

Trace of ln S&P 500(t) – ln S&P(t-1)Trace of ln S&P 500(t) – ln S&P(t-1)

-0.3

-0.2

-0.1

0.0

0.1

0.2

70 75 80 85 90 95 00

DLNSP500

Trace of lnsp500 - lnsp500(-1)

5555

Histogram of Histogram of ln S&P 500(t) – ln S&P(t-1)ln S&P 500(t) – ln S&P(t-1)

0

20

40

60

80

100

-0.2 -0.1 0.0 0.1

Series: DLNSP500Sample 1970:02 2003:02Observations 397

Mean 0.008625Median 0.011000Maximum 0.155371Minimum -0.242533Std. Dev. 0.045661Skewness -0.614602Kurtosis 5.494033

Jarque-Bera 127.8860Probability 0.000000

5656

The First Difference of ln S&P The First Difference of ln S&P 500(t)500(t)

ln S&P 500(t)=ln S&P 500(t) - ln S&P 500(t-1) ln S&P 500(t) = a + b*t + RW(t) -

{a + b*(t-1) + RW(t-1)} ln S&P 500(t) = b + RW(t) = b + WN(t)

• Note that differencing ln S&P 500(t) where both components, trend and the random walk were evolutionary, results in two components, a constant and white noise, that are stationary.

5757

Analysis(Decomposition)Analysis(Decomposition)

• Lesson one: Plot the time series

• Lesson two: Use logarithmic transformation to linearize

• Lesson three: Use difference transformation to reduce an evolutionary process to a stationary process

5858

Model Two: White NoiseModel Two: White Noise

• Kurtosis or fat tails tend to characterize financial time series

5959

The Lag Operator, ZThe Lag Operator, Z

• Z x(t) = x(t-1)• Zn x(t) = x(t-n)• RW(t) – RW(t-1) = (1 – Z) RW(t) = RW(t) = WN(t)• So the difference operator, can be written in

terms of the lag operator, = (1 – Z)

6060

Model Three: Model Three: Autoregressive Time Series of Autoregressive Time Series of

Order OneOrder One• An analogy to our model of trend plus

shock for the logarithm of the Standard Poors is inertia plus shock for an economic time series such as the ratio of inventory to sales for total business

• Source: FRED http://research.stlouisfed.org/fred/

6161

Trace of Inventory to Sales, Trace of Inventory to Sales, Total Business Total Business

1.30

1.35

1.40

1.45

1.50

1.55

1.60

92 93 94 95 96 97 98 99 00 01 02 03

RATIOINVSALE

Ratio of Inventory to Sales, Monthly, 1992:01-2003:01

6262

AnalogyAnalogy

• Trend plus random walk:

• Ln S&P 500(t) = a + b*t + RW(t)

• where RW(t) = RW(t-1) + WN(t)

• inertia plus shock

• Ratioinvsale(t) = b*Ratioinvsale(t-1) + WN(t)

6363

Model Three: Autoregressive of Model Three: Autoregressive of First OrderFirst Order

• Note: RW(t) = 1*RW(t-1) + WN(t)

• where the coefficient b = 1

• Contrast ARONE(t) = b*ARONE(t-1) + WN(t)

• What would happen if b were greater than one?

6464

Using Simulation to Explore Using Simulation to Explore Time Series BehaviorTime Series Behavior

• Simulating White Noise:

• EVIEWS: new workfile, irregular, 1000 observations, GENR WN = NRND

6565

Trace of Simulated White Noise:Trace of Simulated White Noise:100 Observations100 Observations

-3

-2

-1

0

1

2

3

10 20 30 40 50 60 70 80 90 100

WN

Simulated White Noise

6666

Histogram of Simulated White Histogram of Simulated White NoiseNoise

0

20

40

60

80

100

120

-3 -2 -1 0 1 2 3 4

Series: WNSample 1 1000Observations 1000

Mean 0.008260Median -0.003042Maximum 3.782479Minimum -3.267831Std. Dev. 1.005635Skewness -0.047213Kurtosis 3.020531

Jarque-Bera 0.389072Probability 0.823216

6767

Simulated ARONE ProcessSimulated ARONE Process

• SMPL 1 1, GENR ARONE = WN

• SMPL 2 1000

• GENR ARONE =1.1* ARONE(-1) + WN

• Smpl 1 1000

6868

Simulated Unstable First Order Simulated Unstable First Order Autoregressive Process Autoregressive Process

-20000

-15000

-10000

-5000

0

10 20 30 40 50 60 70 80 90 100

ARONE

First 100 Observations of ARONE = 1.1*Arone(-1) + WN

6969

First 10 Observations of ARONEFirst 10 Observations of ARONE

obs WN ARONE

1 -1.204627 -1.2046272 -1.728779 -3.0538693 1.478125 -1.8811314 -0.325830 -2.3950735 -0.593882 -3.2284636 0.787438 -2.7638727 0.157040 -2.8832198 -0.211357 -3.3828989 -0.722152 -4.44334010 0.775963 -4.111711

7070

Model Three: AutoregressiveModel Three: Autoregressive

• What if b= -1.1?

• ARONE*(t) = -1.1*ARONE*(t-1) + WN(t)

• SMPL 1 1, GENR ARONE* = WN

• SMPL 2 1000

• GENR ARONE* = -1.1*ARONE*(-1) + WN

• SMPL 1 1000

7171

Simulated Autoregressive, b=-1.1Simulated Autoregressive, b=-1.1

-400

-200

0

200

400

5 10 15 20 25 30 35 40 45 50 55 60

ARONESTAR

Simulated First Order Autoregressive Process, b = -1.1

7272

Model Three: ConclusionModel Three: Conclusion

• For Stability ( stationarity) -1<b<1

7373

Part IIPart II

• Forecasting: A preview of coming attractions

7474

Ratio of Inventory to SalesRatio of Inventory to Sales

• EVIEWS Model: Ratioinvsale(t) = c + AR(1)

• Ratioinvsale is a constant plus an autoregressive process of the first order

• AR(t) = b*AR(t-1) + WN(t)

• Note: Ratioinvsale(t) - c = AR(t), so

• Ratioinvsale(t) - c = b*{ Ratioinvsale(t-1) - c} + WN (t)

7575

Ratio of Inventory to SalesRatio of Inventory to Sales

• Use EVIEWS to estimate coefficients c and b.

• Forecast of Ratioinvsale at time t is based on knowledge at time t-1 and earlier (information base)

• Forecast at time t-1 of Ratioinvsale at time t is our expected value of Ratioinvsale at time t

7676

One Period Ahead ForecastOne Period Ahead Forecast

• Et-1[Ratioinvsale(t)] is:

• Et-1[Ratioinvsale(t) - c] =

• Et-1[Ratioinvsale(t)] - c =

• Forecast - c = b*Et-1[Ratioinvsale(t-1) - c] + Et-1[WN(t)]

• Forecast = c + b*Ratioinvsale(t-1) -b*c + 0

7777

Dependent Variable: RATIOINVSALEMethod: Least SquaresDate: 04/08/03 Time: 13:56Sample(adjusted): 1992:02 2003:01Included observations: 132 after adjusting endpoints

Convergence achieved after 3 iterations

Variable Coefficient Std. Error t-Statistic Prob.

C 1.417293 0.030431 46.57405 0.0000AR(1) 0.954517 0.024017 39.74276 0.0000

R-squared 0.923954 Mean dependent var 1.449091

Adjusted R-squared 0.923369 S.D. dependent var 0.046879

S.E. of regression 0.012977 Akaike info criterion -5.836210

Sum squared resid 0.021893 Schwarz criterion -5.792531

Log likelihood 387.1898 F-statistic 1579.487

Durbin-Watson stat 2.674982 Prob(F-statistic) 0.000000

Inverted AR Roots .95

7878

How Good is This Estimated How Good is This Estimated Model?Model?

-0.06

-0.04

-0.02

0.00

0.02

0.04

0.06

1.30

1.35

1.40

1.45

1.50

1.55

1.60

93 94 95 96 97 98 99 00 01 02 03

Residual Actual Fitted

7979

Plot of the Estimated ResidualsPlot of the Estimated Residuals

0

5

10

15

20

25

-0.050 -0.025 0.000 0.025

Series: ResidualsSample 1992:02 2003:01Observations 132

Mean -2.74E-13Median 0.000351Maximum 0.042397Minimum -0.048512Std. Dev. 0.012928Skewness 0.009594Kurtosis 4.435641

Jarque-Bera 11.33788Probability 0.003452

8080

Forecast for Ratio of Inventory Forecast for Ratio of Inventory to Sales for February 2003to Sales for February 2003

• E2003:01 [Ratioinvsale(2003:02)= c - b*c + b*Ratioinvsale(2003:02)

• Forecast = 1.417 - 0.954*1.417 + 0.954*1.360

• Forecast = 0.06514 + 1.29744

• Forecast = 1.36528

8181

How Well Do We Know This How Well Do We Know This Value of the Forecast?Value of the Forecast?

• Standard error of the regression = 0.0130

• Approximate 95% confidence interval for the one period ahead forecast = forecast +/- 2*SER

• Ratioinvsale(2003:02) = 1.36528 +/- 2*.0130

• interval for the forecast 1.34<forecast<1.39

8282

Trace of Inventory to Sales, Trace of Inventory to Sales, Total Business Total Business

1.30

1.35

1.40

1.45

1.50

1.55

1.60

92 93 94 95 96 97 98 99 00 01 02 03

RATIOINVSALE

Ratio of Inventory to Sales, Monthly, 1992:01-2003:01

8383

Lessons About ARIMA Lessons About ARIMA Forecasting ModelsForecasting Models

• Use the past to forecast the future

• “sophisticated” extrapolation models

• competitive extrapolation models– use the mean as a forecast for a stationary time

series, Et-1[y(t)] = mean of y(t)

– next period is the same as this period for a stationary time series and for random walks, Et-1[y(t)] = y(t-1)

– extrapolate trend for an evolutionary trended time series, Et-1[y(t)] = a + b*t = y(t-1) + b