# Statistical Techniques I EXST7005 Multiple Regression.

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

Statistical Techniques I EXST7005 Multiple Regression

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

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).

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.

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.

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?

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.

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.

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;

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

Example with Extra SS (continued) n YX1X2X3 1292 3465 5779 3355 6589 4342 2236 8621 9753 3824 5737 6914

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

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 = 23.978 n SSX2 = 4.115 n SSX3 = 0.237 n These SS are adjusted only for the intercept (correction factor). This will always be the case for our examples.

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 = 38.842, SSModel = 24.074 n Regression of Y on X1 and X3 è SSError = 37.546, SSModel = 25.371 n Regression of Y on X2 and X3 è SSError = 58.779, SSModel = 4.137

Example with Extra SS (continued) n Now lets get the Extra SS for variables fitted together. è SSX1 alone = 23.978 è SSX2 alone = 4.115 è SSX1 and X2 together = 24.074 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.

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 = 24.074). The improvement with X2 is 24.074-23.978 = 0.096 = SSX2|X1 è Start with X2 (SSX2=4.115), Add X1 (SSX1,X2=24.074). The improvement is 24.074- 4.115 = 19.959 = SSX1|X2 n So, SSX1|X2=19.959, and SSX2|X1=0.096

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

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 4.137-4.115 = 0.022 = SSX3|X2 è Start with X3 (SSX3=0.237), Add X2 (SSX2,X3 = 4.137). The improvement is 4.137-0.237 = 3.900 = SSX2|X3 n So, SSX2|X3=3.900, and SSX3|X2=0.022

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=26.190 è SSX1,X2 = 24.074, So SSX3|X1,X2=2.116 è SSX1,X3 = 25.371, So SSX2|X1,X3=0.819 è SSX2,X3 = 4.137, So SSX1|X2,X3=22.053

Example with Extra SS (continued) n Summarizing the Extra SS calculations. Extra SSSSd.f. ErrorError SS SSX123.9781038.939 SSX24.1151058.802 SSX30.2371062.680 SSX1|X219.959938.843 SSX2|X10.096938.843 SSX1|X325.134937.546 SSX3|X11.393937.546 SSX2|X33.900958.780 SSX3|X20.022958.780

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,X322.053836.727 SSX2|X1,X30.819836.727 SSX3|X1,X22.116836.727

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).

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.

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.

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.

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.

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.

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.

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,X3122.053 4.804 SSX2|X1,X310.819 0.178 SSX3|X1,X212.116 0.461 ERROR836.7274.591

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.

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.

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|X3125.134 6.024 SSX3|X111.393 0.334 ERROR937.5464.172

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 SSX1123.977 6.158 ERROR1038.9393.894

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.

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).

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.

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.

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 23.978, but dropped to 19.959 when adjusted for X2 and increased to 25.134 when adjusted for X3. It dropped to 22.053 when adjusted for both.

Adjusted SS Extra SSSS SSX123.978 SSX24.115 SSX30.237 SSX1|X219.959 SSX2|X10.096 SSX1|X325.134 SSX3|X11.393 SSX2|X33.900 SSX3|X20.022 SSX1|X2,X322.053 SSX2|X1,X30.819 SSX3|X1,X22.116

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.

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.

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.

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.

Fin n The End

Download ppt "Statistical Techniques I EXST7005 Multiple Regression."

Similar presentations