Stat 5511 - Lab 6 –Fall 2011 1) regression with multiple regressors in the model, options ls=80; data temp; infile '~/5511/txtfiles/data-table-B02.txt'; input y x1 x2 x3 x4 x5; proc reg; model y=x1 x2 x3/r; /* x1, x2 and x3 are regressors in the model*/ output out= rplot r=residual; proc print; var residual; run; The command “model y=x1 x2 x3 “ does the regression with x1 x2 an x3. The option r gives the residuals. 2)Type I and II SS: Create a SAS file to input the following code (notice options ss1 and ss2): options ls=80; data type_ss; input x1 x2 y; datalines; 4 1 3 3 1 4 6 2 4 6 5 7 12 3 15 10 2 5 3 7 4 ; proc reg data=type_ss; model y=x1 x2/p xpx i clb ss1 ss2; run; Here the xpx will give X X , X Y , Y X , Y Y matrices and i gives ( X X )1 . The clb gives a confidence interval for your parameters, and ss1 and ss2 give sum of squares type and sum of squares type . Given the model Yi= β0+ β1xi1+ β2xi2+ β3xi3+εi Variable DF Type I SS Type II SS ----------------------------------------------------------------------------------Intercept 1 SSR(β0) SSR(β0| β1, β2, β3) x1 1 SSR(β1| β0) SSR(β1| β0, β2, β3) x2 1 SSR(β2| β0, β1) SSR(β2| β0, β1, β3) x3 1 SSR(β3| β0, β1, β2) SSR(β3| β0, β1, β2) The Type SS gives the sum of squares for the newly added parameter. An important thing to remember is that order matters when looking at Type SS i.e. on the line model y=x1 x2/p xpx i clb ss1 ss2; if we were to write model y=x2 x1 …, then the Type SS for the two models would be different. You can compare them by creating another model directly below the original model. One nice property of Type SS is the sum of the Type SS (excluding the intercept) sum to SSR. Type II SS looks at the sum of squares given that every other parameter is already in the model. This can be a good way to find which predictor variables are most independent from the rest of the variables in the model. In other words, this sum of squares is good to use when building a model (i.e. you can choose the predictor which explains the most variability and add that to the model). In the output, you will find the Type II SS underneath the heading "Parameter Estimates”. Note: There will be two Parameter Estimate headings adjacent to each other. Under the second heading is the Type II SS. Parameter Estimates Variable DF Type II SS 95% Confidence Limits Intercept x1 x2 1 1 1 1.57558 66.68220 5.34277 -10.01076 -0.01492 -1.10107 7.37864 1.93660 1.95207