Topics 1. Multiple Regression Estimation Global Test Individual Coefficient Test 2. Regression Assumptions and Regression Diagnostics Error Term Distribution Multicollinearity Heteroscedascity Autocorrelation 3. Dummy Variable 4. Stepwise Regression 13-2
Multiple Regression Analysis a and b 1, b 2, …, b k are estimated coefficients from the sample. b i is the net change in Y for each unit change in X i holding other X’s constant. The least squares criterion is used to develop this equation Multiple Linear Regression Model: Y = α + β 1 X 1 + β 2 X 2 + ··· +β k X k + ε Estimated Regression Equation: = a + b 1 X 1 + b 2 X ··· +b k X k Y is the dependent variable and X 1, X 2, … X k are the independent variable. α, β 1, β 2, …, β k are population coefficients that need to be estimated using sample data. ε is the error term. The model represents the linear relationship between the two variables in the population
Multiple Linear Regression - Example Salsberry Realty sells homes along the east coast of the United States. One of the questions most frequently asked by prospective buyers is: If we purchase this home, how much can we expect to pay to heat it during the winter? The research department at Salsberry has been asked to develop some guidelines regarding heating costs for single-family homes. Three variables are thought to relate to the heating costs: (1) the mean daily outside temperature, (2) the number of inches of insulation in the attic, and (3) the age in years of the furnace. To investigate, Salsberry’s research department selected a random sample of 20 recently sold homes. It determined the cost to heat each home last January, as well as the January outside temperature in the region, the number of inches of insulation in the attic, and the age of the furnace. X1X1 X2X2 X3X Data SalsberrySalsberry
SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations20 ANOVA dfSSMSFSignificance F Regression E-06 Residual Total Coefficients Standard Errort StatP-valueLower 95%Upper 95% Intercept E Temp E Insul Age Multiple Linear Regression – Excel Output a b 1, b 2, and b 3, 14-5 See Excel instruction in the textbook, P 566, #2.
Estimating the Multiple Regression Equation Interpreting the Regression Coefficients The regression coefficient for mean outside temperature, X 1, is For every unit increase in temperature, holding the other two independent variables constant, monthly heating cost is expected to decrease by $ The attic insulation variable, X 2, also shows a negative relationship. For each additional inch of insulation, the cost to heat the home is expected to decline by $14.83 per month,. The age of the furnace variable shows a positive relationship. For each additional year older the furnace is, the cost is expected to increase by $6.10 per month. 14-6
Using the Multiple Regression Equation Applying the Model for Estimation What is the estimated heating cost for a home if the mean outside temperature is 30 degrees, there are 5 inches of insulation in the attic, and the furnace is 10 years old?
Fitness of the model—Adjusted r 2 The Adjusted R 2 1. R 2 is inflated by the number of independent variables. 2. In multiple regression analysis, the adjusted R 2 is a better measurement of the fitness of the model. 3. Ranges from 0 to The Adjusted R 2 is adjusted by the number of independent variables and sample size. 5. It measures the percentage of total variation in Y that is explained by all independent variables, that is, explained by the regression model SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations20 About 76.7% of the variation in the heating cost is explained by the mean outside temperature, attic insulation and the age of furnace.
Global Test: Testing the Multiple Regression Model The global test is used to investigate whether any of the independent variables have coefficients that are significantly different from zero. This is also the test on the validity of the model. The hypotheses are: Decision Rules:(1) Reject H 0 if F > F ,k,n-k-1 or (2) Reject H 0 if p-value<α 14-9
F-distribution The distribution takes nonnegative values only. Asymmetric, skewed to the right. The shape of the distribution is controlled by 2 degrees of freedoms, denoted v1 and v2. The degrees of freedoms are usually reported in the ANOVA table in the output ANOVA dfSSMSFSignificance F Regression E-06 Residual Total Excel function: =FINV(α, k, n-k-1)
ANOVA dfSSMSFSignificance F Regression E-06 Residual Total Global test—Example Significance level: α= Test statistic: F=21.90
ANOVA dfSSMSFSignificance F Regression E-06 Residual Total Global test—Example Rule (1) Rejection region: Reject H 0 if F >3.24 According to step 3, F=21.90, which falls in the rejection region. Rule (2) Reject H 0 if p-value < α p-value =0.00, less than Decision: rejection the null hypothesis =FINV(.05, 3, 16) = 3.24
Interpretation The null hypothesis that all the multiple regression coefficients are zero is rejected. Interpretation: Some of the independent variables are useful in predicting the dependent variable (heating cost). Some of the independent variables are linearly related to the dependent variable. The model is valid. Logical question – which ones? 14-13
This test is used to determine which independent variables have nonzero regression coefficients. The variables that have nonzero regression coefficients are said to have significant coefficients (significantly different from zero). The variables that have zero regression coefficients can be dropped from the analysis. The test statistic follows t distribution. The test hypotheses test are: H 0 : β i = 0 H 1 : β i ≠ 0 Instead of comparing test statistic with rejection region for each independent variable (which is tedious), we rely on the p-values. If p-value < α, we reject the null hypothesis. Evaluating Individual Regression Coefficients (β i ) 14-14
P-values for the Slopes Coefficients Standard Errort StatP-valueLower 95%Upper 95% Intercept E Temp E Insul Age For temperature:For Insulation:For furnace age: H 0 : β 1 = 0 H 0 : β 2 = 0 H 0 : β 3 = 0 H 1 : β 1 ≠ 0 H 1 : β 2 ≠ 0 H 1 : β 3 ≠ 0 P-value=.00 <.05 P-value=.007 <.05 P-value=.148 <.05 Conclusions: For temperature and insulation, rejection the null hypothesis. (1)The coefficients are significant (significantly different from zero); (2)The variables are linearly related to heating cost (3)The variables are useful in predicting heating cost For furnace age, do not rejection the null hypothesis. (1)the coefficient is insignificant and thus can be dropped from the model (2)The variable is not linearly related to heating cost (3)The variable is not useful in predicting heating cost
New Regression without Variable “Age” SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations20 ANOVA dfSSMSFSignificance F Regression E-06 Residual Total Coefficients Standard Errort StatP-valueLower 95% Upper 95% Lower 95.0% Upper 95.0% Intercept E Temp E Insul
d.f. (2,17) 3.59 ANOVA dfSSMSFSignificance F Regression E-06 Residual Total New Regression Model without Variable “Age” 2. Significance level: α= Test statistic: F= Rejection region: Reject H 0 if F >3.59, test statistic falls in the rejection region. p-value =0.00, less than Decision: rejection the null hypothesis
Individual t-test on the new Coefficient For temperature:For Insulation: H 0 : β 1 = 0 H 0 : β 2 = 0 H 1 : β 1 ≠ 0 H 1 : β 2 ≠ 0 P-value=.00 <.05 P-value=.008 <.05 Conclusions: For temperature and insulation, rejection the null hypothesis. (1)The coefficients are significant (significantly different from zero); (2)The variables are linearly related to heating cost (3)The variables are useful in predicting heating cost Coefficients Standard Errort StatP-valueLower 95% Upper 95% Lower 95.0% Upper 95.0% Intercept E Temp E Insul
Multiple Regression Assumptions I. Each of the independent variables and the dependent variable have a linear relationship. II. The independent variables are not correlated. When this assumption is violated, we call the condition multicollinearity. III. The probability distribution of ε is normal. IV. The variance of ε is constant regardless of the value of. This condition is called homoscedasticity. When the requirement is violated, we say heterscedasticity is observed in the regression. V. The error terms are independent of each other. This assumption is often violated when time is involved and we call this condition autocorrelation
Evaluating the Assumptions of Multiple Regression I. There is a linear relationship. We use scatter plot to examine this assumption. II. The independent variables are not correlated. We examine the correlation coefficient among the independent variables. III. The error term follow the normal probability distribution. We use histogram of the residual or normal probability plot to examine the normality. IV. The variance of ε is constant regardless of the value of. V. The error term independent of each other. We plot the residual against the predicted Y to examine the last two assumptions
Assumption I: linear relationship A scatter plot of each independent variable against the dependent variable is used In practice, we can skip this check since the test on individual coefficient will serve the same purpose.
Assumption II: Multicollinearity Multicollinearity exists when independent variables (X’s) are correlated. Effects of Multicollinearity on the Model: 1. An independent variable known to be an important predictor ends up having an insignificant coefficient. 2. A regression coefficient that should have a positive sign turns out to be negative, or vice versa. 3. Multicollieanrity adds difficulty to the interpretation of the coefficients. When one variable changes by 1 unit, other correlated variables will change also (but we require it to be held constant in order to correctly interpret the coefficient). However, correlated independent variables do not affect a multiple regression equation’s ability to predict the dependent variable (Y). Minimizing the effect of multicollinearity is often easier than correcting it: 1.Try to include explanatory variables that are independent of each other. 2.Remove variables that cause multicollinearity in the model
Multicollinearity: Detection A general rule is if the correlation between two independent variables is between and 0.70 there likely is not a problem using both of the independent variables. A more precise test is to use the variance inflation factor (VIF). A VIF > 10 is unsatisfactory. Remove that independent variable from the analysis. The value of VIF is found as follows: The term R 2 j refers to the coefficient of determination, where the selected independent variable is used as a dependent variable and the remaining independent variables are used as independent variables
Multicollinearity – Example Refer to example of heating cost, which is related to the independent variables outside temperature, amount of insulation, and age of furnace. Develop a correlation matrix for all the independent variables. Does it appear there is a problem with multicollinearity? Correlation Matrix Excel: Data-> Data Analysis-> Correlation TempInsulAge Temp1.00 Insul Age None of the correlations (highlighted above) among the independent variables exceed -.7u0 or.70, so we do not suspect problems with multicollinearity.
SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations20 Coefficients Standard Errort StatP-value Intercept Insul Age VIF – Example Coefficient of Determination The VIF value of 1.32 is less than the upper limit of 10. This indicates that the independent variable temperature is not strongly correlated with the other independent variables Find and interpret the variance inflation factor for each of the independent variables. We consider variable temperature first. We run a multiple regression with temperature as the dependent variable and the other two as the independent variables.
VIF – Example None of the VIFs are higher than 10. hence, we conclude there is not a problem with multicollinearity in this example. Note: for your project first obtain correlation matrix. For variables that are associated with correlation coefficients exceeding -.70 or.70, calculated the corresponding VIFs to further determine whether multicollinearity is an issue or not Calculating the VIF for each variable using Excel can be tedious. Minitab generates the VIF values for each independent variable in its output, which is shown below.
Assumption III: Normality of Error Term Histogram (discuss in review) of residuals is used to visually determine whether the assumption of normality is satisfied. Excel offers another graph, normal probability plot, that helps to evaluate this assumption. Basically, if the plotted points are fairly close to a straight line drawn from the lower left to the upper right, the normality assumption is satisfied
Assumption IV & V As we can see from the scatter plot, the residuals are randomly distributed across the horizontal axis and there is no obvious. Therefore, there is no sign of heteroscedasticity or autocorrelation.
Residual Plot versus Fitted Values: Testing the Heteroscedasticity Assumption When the variance of the error term is changing across different values of Y’s, we refer to this condition as heteroscedasticity. In the plot of the residuals against the predicted value of Y, we look for a change in the spread of the plotted points. The spread of the points increases as the predicted value of Y increases. A scatter plot such as this would indicate possible heteroscedasticity
Residual Plot versus Fitted Values: Testing the Independence Assumption When successive residuals are correlated we refer to this condition as autocorrelation, which frequently occurs when the data are collected over a period of time. Note the run of residuals above the mean of the residuals, followed by a run below the mean. A scatter plot such as this would indicate possible autocorrelation
Dummy Variable Dummy variable: Dummy variable is a variable that can assume either one of only two values (usually 1 and 0), where 1 represents the existence of a certain condition and 0 indicates that the condition does not hold. Usually categorical data or nominal data cannot be included in the analysis directly. Instead, we need to use dummy variables to denote the categories. Notation:
Dummy Variable - Example Suppose in the Salsberry Realty example that the independent variable “garage” is added, which indicate whether a house comes with an attached garage or not. To include this variable in our analysis, we define a dummy variable as follows: for those homes without an attached garage, 0 is used; for homes with an attached garage, a 1 is used.
Dummy Variable - Example SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations20 ANOVA dfSSMSFSignificance F Regression E-07 Residual Total CoefficientsStandard Errort StatP-valueLower 95%Upper 95% Intercept E Temp E Insul Garage New estimated regression equation:
Dummy Variable - Example Interpretation: b 3 = 77.4: the heating cost for homes with attached garage is on average $77.4 higher than homes without attached garage, with other conditions being the same
Dummy Variable – Another Example What determines the value of a used car? To examine this issue, a used-car dealer randomly selected year- old Toyota Camrys that were sold at auction during the past month. Each car was in top condition and equipped with all the features that come standard with this car. The dealer recorded the price ($1,000), the number of miles (thousands) on the odometer and the color of the car. When recording the color, the dealer uses 1 to denote white, 2 to denote silver and 3 to denote other colors.
Dummy Variable – Another Example Although variable color include numbers, 1, 2, and 3, they cannot be included in the analysis. Instead we need to generate dummy variables to denote the different categories. Rule of assigning dummy variables: if there are m different categories in the data, generate m-1 dummy variables. The last category is represented by I 1 = I 2 = … = I m-1 = 0, and is called the omitted category. Since there are three categories in variable color, we generate two dummy variables defined as follows: “Other colors” is the omitted category and is represented by I 1 = I 2 =
Dummy Variable – Excel Open data Toyota CamryToyota Camry In the column next to “color” type “I1” to generate the dummy variable for “white.” In the cell below it, type =IF(C2=1, 1, 0) and hit enter. (Excel function: IF(logical_test, [value_if_true], [value_if_false].) Copy the cell and paste to the rest of cells in the column till the cell in the previous column is empty. Similarly, generate the dummy variable for “silver” in the next column by typing =IF(C2=2, 1, 0) and follow the same procedure. To run regression, we need to put the explanation variables together. Copy the column of Odometer and past to the column next to the second dummy variable. Run multiple regression using the 2 dummy variables and Odometer
Dummy Variable – Excel SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations100 ANOVA dfSSMSF Significance F Regression E-25 Residual Total Coefficients Standard Errort StatP-valueLower 95%Upper 95%Lower 95.0%Upper 95.0% Intercept E I I Odometer E Estimated regression equation:
Dummy Variable – Interpretation The coefficient of I 1 : b 1 = 0.09: A white Camry sells for.0911 thousand or $91.10 on average more than other colors (nonwhite, nonsilver) with the same odometer reading. The coefficient of I 2 : b 2 = : A silver Camry sells for.3304 thousand or $33.04 on average more than other colors (nonwhite, nonsilver) with the same odometer reading
Stepwise Regression The advantages to the stepwise method are: 1. Only independent variables with significant regression coefficients are entered into the equation. 2. The steps involved in building the regression equation are clear. 3. It is efficient in finding the regression equation with only significant regression coefficients. 4. The changes in the multiple standard error of estimate and the coefficient of determination are shown
Stepwise Regression – Minitab Example The stepwise MINITAB output for the heating cost problem follows. Temperature is selected first. This variable explains more of the variation in heating cost than any other proposed independent variables. Garage is selected next, followed by Insulation. Variable age is not selected 14-42