Presentation is loading. Please wait.

Presentation is loading. Please wait.

Statistical Techniques I EXST7005 Multiple Regression.

Similar presentations


Presentation on theme: "Statistical Techniques I EXST7005 Multiple Regression."— Presentation transcript:

1 Statistical Techniques I EXST7005 Multiple Regression

2 n Multiple Regression n The objectives are the same. Testing hypotheses about potential relationships (correlations), fitting and documenting relationships, and estimating parameters with confidence intervals. n The big difference is that a multiple regression will correlate a dependent variable (Y) with several independent variables (X's). Multiple Regression

3 Multiple Regression (continued) n The regressions equation is similar. n The sample equation is n Yi = b0 + b1x1i + b2x2i + b3x3i + ei n The assumptions for the regression are the same as for Simple Linear Regresson n The interpretation of the parameter estimates are the same (units are Y units per X units, and measure the change in Y for a 1 unit change in X).

4 Multiple Regression (continued) n Diagnostics are the same for simple linear regression and multiple regression. è Residuals can still be examined for outliers, homogeniety, normality, curvature, etc. as with SLR. è The only difference is that, since we have several X's, we would usually plot the residuals on Yhat instead of a single X variable.

5 Multiple Regression (continued) n There is only really one new issue here, and this is in the way we estimate the parameters. n If the independent (X) variables were totally and absolutely independent (covariance or correlation = 0), then it wouldn't make any difference if we fitted them one at a time or all together, they would have the same value.

6 Multiple Regression (continued) n However, in practice there will always be some correlation between the X variables. è If two X variables were PERFECTLY correlated, they would both account for the SAME variation in Y, so which would get the variation? è If two X variables are only partially correlated they would share part of the variation in Y, so how is it partitioned?

7 Multiple Regression (continued) n To demonstrate this we will look at a simple example and develop a new notation called the Extra SS. n For multiple regression there will be, as with simple linear regression, a SS for the "MODEL". This SS lumps together all SS for all variables. This is not usually very informative. We will want to look at the variables individually.

8 Multiple Regression (continued) n To do this there are two other SS provided by SAS. è In PROC REG these are not provided by default. To see them you must request them. This can be done by adding the options SS1 and/or SS2 to the model statement. è In PROC GLM (which will do regressions nicely, but has fewer diagnostics than PROC REG), the TYPE 1 and TYPE 3 SS are provided by default. For regression TYPE 2 and TYPE 3 are the same.

9 Multiple Regression (continued) n To do multiple regression in SAS we simple specify a model with the variables of interest. n For example, a regression on Y with 3 variables X1, X2 and X3 would be specified as è PROC REG; MODEL Y = X1 X2 X3; n To get the SS1 and SS2 we add è PROC REG; MODEL Y=X1 X2 X3 /ss1 ss2;

10 Example with Extra SS n The simple example is done with created data set. n

11 Example with Extra SS (continued) n YX1X2X

12 Example with Extra SS (continued) n Now lets look at simple linear regressions for each variable independently n The SSTotal is for all models n Regression of Y on X1 è SSError = , SSModel = n Regression of Y on X2 è SSError = , SSModel = n Regression of Y on X3 è SSError = , SSModel = 0.237

13 Example with Extra SS (continued) n We call this SSModel, which is the amount of the SS accounted for by each variable alone the Extra SS for X1 or X2 or X3. n SSX1 = n SSX2 = n SSX3 = n These SS are adjusted only for the intercept (correction factor). This will always be the case for our examples.

14 Example with Extra SS (continued) n Now fit X1 and X2 and X3 together two at a time. n We get the following results. n Regression of Y on X1 and X2 è SSError = , SSModel = n Regression of Y on X1 and X3 è SSError = , SSModel = n Regression of Y on X2 and X3 è SSError = , SSModel = 4.137

15 Example with Extra SS (continued) n Now lets get the Extra SS for variables fitted together. è SSX1 alone = è SSX2 alone = è SSX1 and X2 together = n Look at the improvement in the model affected by the second variable. Calculate how much each variable adds to a model with the other variable already in the model.

16 Example with Extra SS (continued) n For the model with X1 and X2, subtract the amount accounted for each variable alone from the amount together. è Start with X1 (SSX1=23.978), Add X2 (SSX1,X2 = ). The improvement with X2 is = = SSX2|X1 è Start with X2 (SSX2=4.115), Add X1 (SSX1,X2=24.074). The improvement is = = SSX1|X2 n So, SSX1|X2=19.959, and SSX2|X1=0.096

17 Example with Extra SS (continued) n Likewise for the model with X1 and X3. è Start with X1 (SSX1=23.978), Add X3 (SSX1,X3 = ). The improvement is = = SSX3|X1 è Start with X3 (SSX3=0.237), Add X1 (SSX1,X3 = ). The improvement is = = SSX1|X3 n So, SSX1|X3=25.134, and SSX3|X1=1.393

18 Example with Extra SS (continued) n Likewise for the model with X2 and X3. è Start with X2 (SSX2=4.115), Add X3 (SSX2,X3 = 4.137). The improvement is = = SSX3|X2 è Start with X3 (SSX3=0.237), Add X2 (SSX2,X3 = 4.137). The improvement is = = SSX2|X3 n So, SSX2|X3=3.900, and SSX3|X2=0.022

19 Example with Extra SS (continued) n Finally, and most important, for all 3 variables in the model. How much does each variable improve the model over a model with the other two variables present in the model? è All start with the full model, SSX1,X2,X3= è SSX1,X2 = , So SSX3|X1,X2=2.116 è SSX1,X3 = , So SSX2|X1,X3=0.819 è SSX2,X3 = 4.137, So SSX1|X2,X3=22.053

20 Example with Extra SS (continued) n Summarizing the Extra SS calculations. Extra SSSSd.f. ErrorError SS SSX SSX SSX SSX1|X SSX2|X SSX1|X SSX3|X SSX2|X SSX3|X

21 Example with Extra SS (continued) n Summarizing the Extra SS calculations. Note that all Extra SS are also corrected for the intercept. Extra SSSSd.f. ErrorError SS SSX1|X2,X SSX2|X1,X SSX3|X1,X

22 Type I SS n So, what is important here? n When we fit regression, we are interested in one of two types of SS. The first one is the SAS type 1 SS, the second is SAS type 2 or 3 or 4 (which are the same for regression analysis).

23 Type I SS (continued) n The SAS Type 1 SS are called the sequentially adjusted SS. They have a number of potential problems. è These SS are adjusted in a sequential or serial fashion. Each SS is adjusted for the variables previously entered in the model, but not for variables entered later. For the model [Y = X1 X2 X3], X1 would be first and adjusted for nothing else (except X0). X2 would enter second, be adjusted for X1, but not for X3. X3 enters last and is adjusted for both X1 and X2.

24 Type I SS (continued) n The SAS Type 1 SS are called the sequentially adjusted SS. They have a number of potential problems. è This then gives è SSX1 è SSX2|X1 è SSX3|X1,X2.

25 Type I SS (continued) n Type I SS (continued) è Unfortunately, the SS are different depending on the order the variables are entered, so different researchers would get different results. è Use of this SS type is rare, it is only used where there is a mathematical reason to place the variables in a particular order. è Use is restricted pretty much to polynomial regressions (which we will not cover) and some other odd applications.

26 Type I SS (continued) n Type I SS (continued) è For the model Y = X1 X2 X3 in SAS the Type I SS are è SSX1, SSX2|X1, SSX3|X1,X2 n Other orders would give different SS and different results. n So, we will not use Type I at all. However, they are provided by default by SAS PROC GLM.

27 Type II SS n The other SS are called PARTIAL SS, or fully adjusted SS, or uniquely attributable SS. These are the ones most often used. n From the "fully adjusted" terminology you might guess that we are talking about each variable fitted after the other variables. n This is correct.

28 Type II SS (continued) n Note that in SAS, for regression, Type II and TYPE III and TYPE IV are the same. SAS provides TYPE II in PROC REG and it provides TYPE I and TYPE III by default in PROC GLM. n Testing and evaluation of variables is usually done with the TYPE II or TYPE III SS.

29 Type II SS (continued) n ANOVA table for this analysis (F0.05,1,8=5.32), using the TYPE III SS (Partial SS). Sourced.f.SSMSF value SSX1|X2,X SSX2|X1,X SSX3|X1,X ERROR

30 Evaluation of Multiple Regression If your objective is to test the 3 variables jointly, you are done at this point. None of the variables is significantly different from zero (H0:  i = 0). n If, however, your objective is to develop the simplest possible, most parsimonious model, you may delete the variables one at time.

31 Evaluation of Multiple Regression (continued) n Why one at a time? Because when you remove a variable everything changes since they are adjusted for each other. n We would remove the least significant variable (the one with the smallest F value). In this case that would be X2.

32 Type II SS (continued) n ANOVA table for analysis of the variables X1 and X3 alone. (F0.05,1,9=5.117). n Note that X1 is now significant, but X3 is not and may be removed. Sourced.f.SSMSF value SSX1|X SSX3|X ERROR

33 Evaluation of Multiple Regression (continued) n The variable X1 is still significant. (F0.05,1,10=4.965) n This one at a time variable removal process is called "stepwise regression". Sourced.f.SSMSF value SSX ERROR

34 Interpretation of regression n Objectives can vary. You may be interested in testing the correlations (actually "partial" correlations due to the adjustment of one variable for another). n Or, you may be interested in the parameter estimates and the resulting model (reduce or full). n The paramter estimates are interpreted as before, the change in Y per unit X. Of course, adjusted for other effects.

35 Interpretation of regression (continued) n Confidence intervals on the parameters are the same as with SLR. The d.f. for the t value is based on the MSE (for the final model). The parameter and standard errors are estimated by SAS. n Residual evaluation is very similar to SLR, but residuals are usually plotted on Yhat instead of X, since there are several independent variables (i.e. X's).

36 Interpretation of regression (continued) n There are a few things that are different. n The R2 value is now called the coefficient of multiple determination (instead of the coefficient of determination). n As discussed, we now evaluate SS for the individual variables. Note that the tests of TYPE III SS are identical to the tests of the regression coefficients (see GLM handout). PROC REG does only the latter, and will not do the former.

37 Interpretation of regression (continued) n There is a suite of new diagnostics for evaluating the multiple independent variables and their interrelations. We will not discuss these, except to say that if the independent variables are highly correlated with each other (r around 0.9), then the parameter estimates can fluctuate wildly and unpredictably.

38 Interpretation of regression (continued) n Also note a curious behavior of the variables when they occur together. è When one Xi is adjusted for another independent (X) variable, sometimes it's SS are larger, and sometimes smaller. This is unpredictable and can go either way. è For example. SSX1 was , but dropped to when adjusted for X2 and increased to when adjusted for X3. It dropped to when adjusted for both.

39 Adjusted SS Extra SSSS SSX SSX SSX SSX1|X SSX2|X SSX1|X SSX3|X SSX2|X SSX3|X SSX1|X2,X SSX2|X1,X SSX3|X1,X22.116

40 Interpretation of regression (continued) n Not only will the SS of one variable increase or decrease as other variables are added, the regression coefficient values will change. They may even change sign, and hence interpretation. So variables in combination do not necessarily have the same interpretation as they might have alone, though the interpretation does not usually change.

41 Example n See SAS output. Important things to note: è Fully adjusted SS also mean fully adjusted regression coefficient (also partial reg. coeff.). SAS REG does not give tests of SS like GLM, but the tests of the bi values are the same as the tests of the Type III SS. è Standard errors are provide for confidence intervals, as well as a test of each regression coefficient against 0 (zero). with an X, it is the correlation of Y with Yhat.

42 Example n See SAS output. Important things to note: è R2 is coefficient of multiple correlation. Instead of its square root being the correlation of Y with an X, it is the correlation of Y with Yhat. è Residuals are output and examined as with SLR, but the plot is on Yhat, not one of the Xi values. è Evaluation of PROC UNIVARIATE for normality and outliers is the same as for SLR.

43 Summary n Multiple regression shares a lot in interpretation and diagnostics with SLR. n The coefficients should be adjusted for each other. This is the Type III SS in SAS. This is the big and important difference from SLR. n Most diagnostics are the same as with SLR.

44 Fin n The End


Download ppt "Statistical Techniques I EXST7005 Multiple Regression."

Similar presentations


Ads by Google