35
slide 1 DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos Lecture 3: Time Series Regression (Ch. 6) Material based on: Bowerman-O’Connell-Koehler, Brooks/Cole

DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

Embed Size (px)

DESCRIPTION

DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos. Lecture 3: Time Series Regression (Ch. 6). Material based on: Bowerman-O’Connell-Koehler, Brooks/Cole. Review of Homework in Textbook. Ex 4.20 Page 210 Ex 4.21 Page 212 Ex 5.5 Page 266 - PowerPoint PPT Presentation

Citation preview

Page 1: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 1

DSCI 5340: Predictive Modeling and Business Forecasting

Spring 2013 – Dr. Nick Evangelopoulos

Lecture 3: Time Series Regression (Ch. 6)

Material based on:Bowerman-O’Connell-Koehler, Brooks/Cole

Page 2: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 2

DSCI 5340FORECASTING

Review of Homework in Textbook

Ex 4.20 Page 210

Ex 4.21 Page 212

Ex 5.5 Page 266

EX 5.10 Page 268

Page 3: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 3

DSCI 5340FORECASTING

Insurance Innovation Data Ex 4.20 Page 210

4.20 part a. Since there are two parallel lines – one for Mutual and one for Stock, a dummy variable can show the difference in the intercepts of the models.

Y = 0 + 1X + 2DS +

Page 4: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 4

DSCI 5340FORECASTING

4.20 part bY = 0 + 1X + 2DS +

a,m = 0 + 1a + 2(0) for X = a assets, and m= Mutual type of company (D = 0)

a,s = 0 + 1a + 2(1) for X = a assets, and m= Stock type of company (D = 1)

a,m - a,s = 2

2 is the difference between the mean of number of months pasted (y) for a mutual type of company and a stock type of company.

Page 5: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 5

DSCI 5340FORECASTING

Since the p-value for 2 is 3.74187E-05, reject H0: 2 = 0, and conclude that 2 is not equal to 0.

95% CI for 2 is 4.98 to 11.13, which does not include 0. Type of Firm is a significant variable in predicting Number of months elapsed at both a significance level of 5% and 1%.

Page 6: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 6

DSCI 5340FORECASTING

Ex 4.20 part d - Interaction

Since the data indicate that the lines for the two type of firms are parallel.

A p-value of .9821 is less than any reasonable alpha level. So the beta coefficient for xDs cannot be assumed to be nonzero.

Page 7: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 7

DSCI 5340FORECASTING

Ex 4.21 page 212

a. Y = 0 + 1DM + 2DT +

For Bottom Shelf, DM = 0 and DT = 0 which implies:

B = 0 + 1(0) + 2(0) = 0.

For Middle Shelf, DM = 1 and DT = 0 which implies:

M = 0 + 1(1) + 2(0) = 0+ 1.For Top Shelf, DM = 0 and DT = 1 which implies: T = 0 + 1(0) + 2(1) = 0+ 2.

M could be used to represent 1

T could be used to represent 2

Page 8: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 8

DSCI 5340FORECASTING

Ex 4.21 part b

4.21 part b. Note if M and T are equal to zero, then:

B = 0, M = 0+ M = 0+ 0, and T = 0 + 2 = 0+ 0.

Thus, H0:M =0 and T = 0 implies H0:B = M = T .

Page 9: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 9

DSCI 5340FORECASTING

Ex 4.21 part c

Since B = 0, M = 0+ M, and T = 0+ T, we can solve for 0, M, and T .

Therefore, M=M -B, T = T -B,

and M-T = M - T .

Note that t(.025, df=15) = 2.131 (see table on page 593).

95% CI for M is 21.4 +/– 2.131*1.433, which is 18.35 to 24.45.

95% CI for T is -4.30 +/– 2.131*1.433, which is -7.35 to -1.25.

Page 10: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 10

DSCI 5340FORECASTING

Ex 4.21 part d page 213

Note that the Fit is 77.2 which corresponds to the mean of the Middle Shelf sales. Thus the output at the bottom of the Analysis of Variance is for a 95% CI and 95% PI for mean sales when using a middle display height.

Page 11: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 11

DSCI 5340FORECASTING

Ex 4.21 part e.

Note that in part c, we were not able to get a confidence interval on M - T since it was equal to M-T . However, if the following model is used: Y = 0 + 1DB + 2DM + then

M - T is equal to M since the Top Shelf is now the reference group.

Note that t(.025, df=15) = 2.131 (same as before).

95% CI for M - T (note equal to M)is 25.7 +/– 2.131*1.433, which is 22.65 to 28.75.

Page 12: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 12

DSCI 5340FORECASTING

Page 266 Ex 5.5 - outliers

Page 13: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 13

DSCI 5340FORECASTING

EX 5.10 part a, Page 268

Y* = 0 + 1X + where Y* = ln(Y).

Prediction point for 7 desktop computers and 95% PI for Y* is 5.0206 and 4.3402 to 5.7010.

Prediction point for 7 desktop computers and 95% PI for Y is exp(5.0206) = 151.5 and exp(4.3402) = 76.72 to exp(5.7010) = 299.166.

Note that putting a “.” for Y* in the data with an X = 7 will provide a prediction interval and predicted value for this value in SAS.

Page 14: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 14

DSCI 5340FORECASTING

EX 5.10 part b, Page 268

There are a couple of small residuals at -.59979.

It may be possible to remove one of these residuals at a time or to try adding a square term to the model.

Page 15: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 15

DSCI 5340FORECASTING

Chapter 6 Polynomial Fits

Use higher order terms when curvature exists in graph of y and x. Typically, x is time and square and cubic terms are added to increase the R square.

Interactions can also be formed with higher order terms.

Page 16: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 16

DSCI 5340FORECASTING

Requirements for Fitting a pth-Order Polynomial Regression Model

1. The number of levels of x must be greater than or equal to (p + 1).

2. The sample size n must be greater than (p + 1) to allow sufficient degrees of freedom for estimating 2.

ppxxxy ...2

210

Page 17: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 17

DSCI 5340FORECASTING

Count the number of times that a curve changes directions.

A polynomial fit would have the highest order term be equal to one minus the number of times the curve changes directions. What degree polynomial would you use here?

Page 18: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 18

DSCI 5340FORECASTING

The use of a model outside its range is dangerous (although sometimes unavoidable).

GN

P (

y)

Inflation Rate (x,%)

Extrapolation

Page 19: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 19

DSCI 5340FORECASTING

xy 10

Line Tending Upward: 1 > 0Curve Tending Downward: 1 < 0

Trend and coefficient sign

Page 20: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 20

DSCI 5340FORECASTING

2210 xxy

Holds Water: 2 > 0

Does Not Hold Water: 2 < 0

Curvature and coefficient sign

Page 21: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 21

DSCI 5340FORECASTING

x

y1

10

Curve Tending Upward: 1 < 0

Curve Tending Downward: 1 > 0

Inverse relationship

Page 22: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 22

DSCI 5340FORECASTING

xey 10

Curve Tending Upward: 1 < 0Curve Tending Downward: 1 > 0

Exponential curve

Page 23: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 23

DSCI 5340FORECASTING

S Curve

y = exp(0 + 1(1/x) + )

Page 24: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 24

DSCI 5340FORECASTING

Line Tending Upward: b1 > 0Curve Tending Downward: b1 < 0

xy 10)log(

Logarithmic transformation for Y

Page 25: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 25

DSCI 5340FORECASTING

)log(10 xy

Curve Tending Upward: b1 > 0Curve Tending Downward: b1 < 0

Logarithmic transformation for X

Page 26: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 26

DSCI 5340FORECASTING

Examples of autocorrelation in residuals

Page 27: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 27

DSCI 5340FORECASTING

Detecting Autocorrelation

Page 28: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 28

DSCI 5340FORECASTING

Detecting Positive Autocorrelation

Page 29: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 29

DSCI 5340FORECASTING

Detecting Negative Autocorrelation

Page 30: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 30

DSCI 5340FORECASTING

Rules of thumb for DW

If DW is close to 2 then there is no autocorrelation.

If DW is close to 0 then there is positive autocorrelation.

If DW is close to 4 then there is negative autocorrelation.

Page 31: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 31

DSCI 5340FORECASTING

Modeling Seasonal Factor with Dummy Variables

Page 32: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 32

DSCI 5340FORECASTING

Trigonometric Models

Model two is for increasing variation cyclically.

Page 33: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 33

DSCI 5340FORECASTING

Autoregressive errors

Use Proc ARIMA for a First Order Autoregressive Process for the Error Term

Page 34: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 34

DSCI 5340FORECASTING

Prediction Intervals for Autoregressive Models

Page 35: DSCI 5340: Predictive Modeling and Business Forecasting Spring 2013 – Dr. Nick Evangelopoulos

slide 35

DSCI 5340FORECASTING

Page 318 Ex 6.3Page 318 Ex 6.4

Homework in Textbook