EPI809/Spring Models With Two or More Quantitative Variables
EPI809/Spring Types of Regression Models
EPI809/Spring First-Order Model With 2 Independent Variables 1. Relationship Between 1 Dependent & 2 Independent Variables Is a Linear Function 2. Assumes No Interaction Between X 1 & X 2 Effect of X 1 on E(Y) Is the Same Regardless of X 2 Values Effect of X 1 on E(Y) Is the Same Regardless of X 2 Values
EPI809/Spring First-Order Model With 2 Independent Variables 1. Relationship Between 1 Dependent & 2 Independent Variables Is a Linear Function 2. Assumes No Interaction Between X 1 & X 2 Effect of X 1 on E(Y) Is the Same Regardless of X 2 Values Effect of X 1 on E(Y) Is the Same Regardless of X 2 Values 3. Model
EPI809/Spring No Interaction
EPI809/Spring No Interaction E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2
EPI809/Spring No Interaction E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2 E(Y) = 1 + 2X 1 + 3(0) = 1 + 2X 1
EPI809/Spring No Interaction E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2 E(Y) = 1 + 2X 1 + 3(1) = 4 + 2X 1 E(Y) = 1 + 2X 1 + 3(0) = 1 + 2X 1
EPI809/Spring No Interaction E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3(2) = 7 + 2X 1 E(Y) = 1 + 2X 1 + 3X 2 E(Y) = 1 + 2X 1 + 3(1) = 4 + 2X 1 E(Y) = 1 + 2X 1 + 3(0) = 1 + 2X 1
EPI809/Spring No Interaction E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3(2) = 7 + 2X 1 E(Y) = 1 + 2X 1 + 3X 2 E(Y) = 1 + 2X 1 + 3(1) = 4 + 2X 1 E(Y) = 1 + 2X 1 + 3(0) = 1 + 2X 1 E(Y) = 1 + 2X 1 + 3(3) = X 1
EPI809/Spring No Interaction Effect (slope) of X 1 on E(Y) does not depend on X 2 value E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3(2) = 7 + 2X 1 E(Y) = 1 + 2X 1 + 3X 2 E(Y) = 1 + 2X 1 + 3(1) = 4 + 2X 1 E(Y) = 1 + 2X 1 + 3(0) = 1 + 2X 1 E(Y) = 1 + 2X 1 + 3(3) = X 1
EPI809/Spring First-Order Model Worksheet Run regression with Y, X 1, X 2
EPI809/Spring Types of Regression Models
EPI809/Spring Interaction Model With 2 Independent Variables 1. Hypothesizes Interaction Between Pairs of X Variables Response to One X Variable Varies at Different Levels of Another X Variable Response to One X Variable Varies at Different Levels of Another X Variable
EPI809/Spring Interaction Model With 2 Independent Variables 1. Hypothesizes Interaction Between Pairs of X Variables Response to One X Variable Varies at Different Levels of Another X Variable Response to One X Variable Varies at Different Levels of Another X Variable 2. Contains Two-Way Cross Product Terms
EPI809/Spring Hypothesizes Interaction Between Pairs of X Variables Response to One X Variable Varies at Different Levels of Another X Variable Response to One X Variable Varies at Different Levels of Another X Variable 2.Contains Two-Way Cross Product Terms 3.Can Be Combined With Other Models Example: Dummy-Variable Model Example: Dummy-Variable Model Interaction Model With 2 Independent Variables
EPI809/Spring Effect of Interaction
EPI809/Spring Effect of Interaction 1.Given:
EPI809/Spring Effect of Interaction 1.Given: 2.Without Interaction Term, Effect of X 1 on Y Is Measured by 1
EPI809/Spring Effect of Interaction 1.Given: 2.Without Interaction Term, Effect of X 1 on Y Is Measured by 1 3.With Interaction Term, Effect of X 1 on Y Is Measured by 1 + 3 X 2 Effect changes As X 2 changesEffect changes As X 2 changes
EPI809/Spring Interaction Model Relationships
EPI809/Spring Interaction Model Relationships E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2 + 4X 1 X 2
EPI809/Spring Interaction Model Relationships E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2 + 4X 1 X 2 E(Y) = 1 + 2X 1 + 3(0) + 4X 1 (0) = 1 + 2X 1
EPI809/Spring Interaction Model Relationships E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2 + 4X 1 X 2 E(Y) = 1 + 2X 1 + 3(1) + 4X 1 (1) = 4 + 6X 1 E(Y) = 1 + 2X 1 + 3(0) + 4X 1 (0) = 1 + 2X 1
EPI809/Spring Interaction Model Relationships Effect (slope) of X 1 on E(Y) does depend on X 2 value E(Y) X1X1X1X E(Y) = 1 + 2X 1 + 3X 2 + 4X 1 X 2 E(Y) = 1 + 2X 1 + 3(1) + 4X 1 (1) = 4 + 6X 1 E(Y) = 1 + 2X 1 + 3(0) + 4X 1 (0) = 1 + 2X 1
EPI809/Spring Interaction Model Worksheet Multiply X 1 by X 2 to get X 1 X 2. Run regression with Y, X 1, X 2, X 1 X 2
EPI809/Spring Thinking challenge Assume Y: Milk yield, X1: food intake and X2: weight Assume Y: Milk yield, X1: food intake and X2: weight Assume the following model with interaction Interpret the interaction Y = 1 + 2X 1 + 3X 2 + 4X 1 X 2 Y = 1 + 2X 1 + 3X 2 + 4X 1 X 2 ^
EPI809/Spring Types of Regression Models
EPI809/Spring Second-Order Model With 2 Independent Variables 1.Relationship Between 1 Dependent & 2 or More Independent Variables Is a Quadratic Function 2.Useful 1 St Model If Non-Linear Relationship Suspected
EPI809/Spring Second-Order Model With 2 Independent Variables 1.Relationship Between 1 Dependent & 2 or More Independent Variables Is a Quadratic Function 2.Useful 1 St Model If Non-Linear Relationship Suspected 3.Model
EPI809/Spring Second-Order Model Worksheet Multiply X 1 by X 2 to get X 1 X 2 ; then X 1 2, X 2 2. Run regression with Y, X 1, X 2, X 1 X 2, X 1 2, X 2 2.
EPI809/Spring Models With One Qualitative Independent Variable
EPI809/Spring Types of Regression Models
EPI809/Spring Dummy-Variable Model 1.Involves Categorical X Variable With 2 Levels e.g., Male-Female; College-No College e.g., Male-Female; College-No College 2.Variable Levels Coded 0 & 1 3.Number of Dummy Variables Is 1 Less Than Number of Levels of Variable 4. May Be Combined With Quantitative Variable (1 st Order or 2 nd Order Model)
EPI809/Spring Dummy-Variable Model Worksheet X 2 levels: 0 = Group 1; 1 = Group 2. Run regression with Y, X 1, X 2
EPI809/Spring Interpreting Dummy-Variable Model Equation
EPI809/Spring Interpreting Dummy-Variable Model Equation Given: Starting s alary of c ollege gra d' s s GPA i i if Female f Male Y Y X X X X Y Y X X X X i i i i i i
EPI809/Spring Interpreting Dummy-Variable Model Equation Given: Starting s alary of c ollege gra d' s s GPA Males ( ): Y Y X X X X Y Y X X Y Y X X X X i i i i i i i i i i i i X X (0) i i if Female f Male X X
EPI809/Spring Interpreting Dummy-Variable Model Equation Same slopes Given: Starting s alary of c ollege gra d' s s GPA Males ( ): Y Y X X X X Y Y X X Y Y X X X X i i i i i i i i i i i i X X (0) i i if Female f Male X X Y Y X X X X i i i i i i (1) Females ( ): X X ) 2 2
EPI809/Spring Dummy-Variable Model Relationships Y X1X1X1X1 0 0 Same Slopes 1 0000 0 + 2 ^ ^ ^ ^ Females Males
EPI809/Spring Dummy-Variable Model Example
EPI809/Spring Dummy-Variable Model Example Computer O utput: f Male if Female i i Y Y X X X X X X i i i i i i
EPI809/Spring Dummy-Variable Model Example Computer O utput: Males ( ): Y Y X X X X Y Y X X X X i i i i i i i i i i i i X X (0) f Male if Female i i X X
EPI809/Spring Dummy-Variable Model Example Same slopes Computer O utput: Males ( ): Y Y X X X X Y Y X X X X i i i i i i i i i i i i X X (0) f Male if Female i i X X Females Y Y X X X X i i i i i i (1) (3 + 7) ): (X(X (X(X
EPI809/Spring Sample SAS codes for fitting linear regressions with interactions and higher order terms PROC GLM data=complex; Class gender; model salary = gpa gender gpa*gender; RUN;
EPI809/Spring Conclusion 1. Explained the Linear Multiple Regression Model 2. Tested Overall Significance 3. Described Various Types of Models 4. Evaluated Portions of a Regression Model 5. Interpreted Linear Multiple Regression Computer Output 6. Described Stepwise Regression 7. Explained Residual Analysis 8. Described Regression Pitfalls