Presentation is loading. Please wait.

Presentation is loading. Please wait.

Stat 112: Lecture 17 Notes Chapter 6.8: Assessing the Assumption that the Disturbances are Independent Chapter 7.1: Using and Interpreting Indicator Variables.

Similar presentations


Presentation on theme: "Stat 112: Lecture 17 Notes Chapter 6.8: Assessing the Assumption that the Disturbances are Independent Chapter 7.1: Using and Interpreting Indicator Variables."— Presentation transcript:

1 Stat 112: Lecture 17 Notes Chapter 6.8: Assessing the Assumption that the Disturbances are Independent Chapter 7.1: Using and Interpreting Indicator Variables.

2 Time Series Data and Autocorrelation When Y is a variable collected for the same entity (person, state, country) over time, we call the data time series data. For time series data, we need to consider the independence assumption for the simple and multiple regression model. Independence Assumption: The residuals are independent of one another. This means that if the residual is positive this year, it needs to be equally likely for the residuals to be positive or negative next year, i.e., there is no autocorrelation. Positive autocorrelation: Positive residuals are more likely to be followed by positive residuals than by negative residuals. Negative autocorrelation: Positive residuals are more likely to be followed by negative residuals than by positive residuals.

3 Ski Ticket Sales Christmas Week is a critical period for most ski resorts. A ski resort in Vermont wanted to determine the effect that weather had on its sale of lift tickets during Christmas week. Data from past 20 years. Y i = lift tickets during Christmas week in year i X i1 =snowfall during Christmas week in year i X i2 = average temperature during Christmas week in year i. Data in skitickets.JMP

4 Residuals suggest positive autocorrelation

5 Durbin-Watson Test of Independence The Durbin-Watson test is a test of whether the residuals are independent. The null hypothesis is that the residuals are independent and the alternative hypothesis is that the residuals are not independent (either positively or negatively) autocorrelated. The test works by computing the correlation of consecutive residuals. To compute Durbin-Watson test in JMP, after Fit Model, click the red triangle next to Response, click Row Diagnostics and click Durbin- Watson Test. Then click red triangle next to Durbin-Watson to get p-value. For ski ticket data, p-value = 0.0002. Strong evidence of autocorrelation

6 Remedies for Autocorrelation Add time variable to the regression. Add lagged dependent (Y) variable to the regression. We can do this by creating a new column and right clicking, then clicking Formula, clicking Row and clicking Lag and then clicking the Y variables. After adding these variables, refit the model and then recheck the Durbin-Watson statistic to see if autocorrelation has been removed.

7

8 Example 6.10 in book

9

10 Categorical variables Categorical (nominal) variables: Variables that define group membership, e.g., sex (male/female), color (blue/green/red), county (Bucks County, Chester County, Delaware County, Philadelphia County). How to use categorical variables as explanatory variables in regression analysis: –If the variable has two categories (e.g., sex (male/female), rain or not rain, snow or not snow), we have defined a variable that equals 1 for one of the categories and 0 for the other category.

11 Predicting Emergency Calls to the AAA Club Rain forecast=1 if rain is in forecast, 0 if not Snow forecast=1 if snow is in forecast, 0 if not Weekday=1 if weekday, 0 if not

12 Comparing Toy Factory Managers An analysis has shown that the time required to complete a production run in a toy factory increases with the number of toys produced. Data were collected for the time required to process 20 randomly selected production runs as supervised by three managers (A, B and C). Data in toyfactorymanager.JMP. How do the managers compare?

13 Marginal Comparison Marginal comparison could be misleading. We know that large production runs with more toys take longer than small runs with few toys. How can we be sure that Manager c has not simply been supervising very small production runs? Solution: Run a multiple regression in which we include size of the production run as an explanatory variable along with manager, in order to control for size of the production run.

14 Including Categorical Variable in Multiple Regression: Wrong Approach We could assign codes to the managers, e.g., Manager A = 0, Manager B=1, Manager C=2. This model says that for the same run size, Manager B is 31 minutes faster than Manager A and Manager C is 31 minutes faster than Manager B. This model restricts the difference between Manager A and B to be the same as the difference between Manager B and C – we have no reason to do this. If we use a different coding for Manager, we get different results, e.g., Manager B=0, Manager A=1, Manager C=2 Manager A 5 min. faster than Manager B

15 Including Categorical Variable in Multiple Regression: Right Approach Create an indicator (dummy) variable for each category. Manager[a] = 1 if Manager is A 0 if Manager is not A Manager[b] = 1 if Manager is B 0 if Manager is not B Manager[c] = 1 if Manager is C 0 if Manager is not C

16 For a run size of length 100, the estimated time for run of Managers A, B and C ar For the same run size, Manager A is estimated to be on average 38.41-(-14.65)=53.06 minutes slower than Manager B and 38.41-(-23.76)=62.17 minutes slower than Manager C.

17 Categorical Variables in Multiple Regression in JMP Make sure that the categorical variable is coded as nominal. To change coding, right clock on column of variable, click Column Info and change Modeling Type to nominal. Use Fit Model and include the categorical variable into the multiple regression. After Fit Model, click red triangle next to Response and click Estimates, then Expanded Estimates (the initial output in JMP uses a different, more confusing coding of the dummy variables).

18 Equivalence of Using One 0/1 Dummy Variable and Two 0/1 Dummy Variables when Categorical Variable has two categories Two models give equivalent predictions. The difference in mean number of Emergency calls between a day with a rain forecast and a day without a rain forecast holding all other variables fixed is 429.71=214.85-(-214.85).

19 Effect Tests Effect test for manager: a : not all manager[a],manager[b],manager[c] equal. Null hypothesis is that all managers are the same (in terms of mean run time) when run size is held fixed, alternative hypothesis is that not all managers are the same (in terms of mean run time) when run size is held fixed. vs. H a : not all manager[a],manager[b],manager[c] equal. Null hypothesis is that all managers are the same (in terms of mean run time) when run size is held fixed, alternative hypothesis is that not all managers are the same (in terms of mean run time) when run size is held fixed. p-value for Effect Test <.0001. Strong evidence that not all managers are the same when run size is held fixed.p-value for Effect Test <.0001. Strong evidence that not all managers are the same when run size is held fixed. Note: equivalent toNote: equivalent to because JMP has constraint that manager[a]+manager[b]+manager[c]=0. Effect test for Run size tests null hypothesis that Run Size coefficient is 0 versus alternative hypothesis that Run size coefficient isn’t zero. Same p-value as t-test.

20 Effect tests shows that managers are not equal. For the same run size, Manager C is best (lowest mean run time), followed by Manager B and then Manager C. The above model assumes no interaction between Manager and run size – the difference between the mean run time of the managers is the same for all run sizes.

21 Election Equation


Download ppt "Stat 112: Lecture 17 Notes Chapter 6.8: Assessing the Assumption that the Disturbances are Independent Chapter 7.1: Using and Interpreting Indicator Variables."

Similar presentations


Ads by Google