Presentation is loading. Please wait.

Presentation is loading. Please wait.

EPI809/Spring 2008 1 Models With Two or More Quantitative Variables.

Similar presentations


Presentation on theme: "EPI809/Spring 2008 1 Models With Two or More Quantitative Variables."— Presentation transcript:

1 EPI809/Spring 2008 1 Models With Two or More Quantitative Variables

2 EPI809/Spring 20082 Types of Regression Models

3 EPI809/Spring 20083 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

4 EPI809/Spring 20084 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

5 EPI809/Spring 20085 No Interaction

6 EPI809/Spring 20086 No Interaction E(Y) X1X1X1X1 4 8 12 0 010.51.5 E(Y) = 1 + 2X 1 + 3X 2

7 EPI809/Spring 20087 No Interaction E(Y) X1X1X1X1 4 8 12 0 010.51.5 E(Y) = 1 + 2X 1 + 3X 2 E(Y) = 1 + 2X 1 + 3(0) = 1 + 2X 1

8 EPI809/Spring 20088 No Interaction E(Y) X1X1X1X1 4 8 12 0 010.51.5 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

9 EPI809/Spring 20089 No Interaction E(Y) X1X1X1X1 4 8 12 0 010.51.5 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

10 EPI809/Spring 200810 No Interaction E(Y) X1X1X1X1 4 8 12 0 010.51.5 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) = 10 + 2X 1

11 EPI809/Spring 200811 No Interaction Effect (slope) of X 1 on E(Y) does not depend on X 2 value E(Y) X1X1X1X1 4 8 12 0 010.51.5 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) = 10 + 2X 1

12 EPI809/Spring 200812 First-Order Model Worksheet Run regression with Y, X 1, X 2

13 EPI809/Spring 200813 Types of Regression Models

14 EPI809/Spring 200814 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

15 EPI809/Spring 200815 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

16 EPI809/Spring 200816 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 3.Can Be Combined With Other Models Example: Dummy-Variable Model Example: Dummy-Variable Model Interaction Model With 2 Independent Variables

17 EPI809/Spring 200817 Effect of Interaction

18 EPI809/Spring 200818 Effect of Interaction 1.Given:

19 EPI809/Spring 200819 Effect of Interaction 1.Given: 2.Without Interaction Term, Effect of X 1 on Y Is Measured by  1

20 EPI809/Spring 200820 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

21 EPI809/Spring 200821 Interaction Model Relationships

22 EPI809/Spring 200822 Interaction Model Relationships E(Y) X1X1X1X1 4 8 12 0 010.51.5 E(Y) = 1 + 2X 1 + 3X 2 + 4X 1 X 2

23 EPI809/Spring 200823 Interaction Model Relationships E(Y) X1X1X1X1 4 8 12 0 010.51.5 E(Y) = 1 + 2X 1 + 3X 2 + 4X 1 X 2 E(Y) = 1 + 2X 1 + 3(0) + 4X 1 (0) = 1 + 2X 1

24 EPI809/Spring 200824 Interaction Model Relationships E(Y) X1X1X1X1 4 8 12 0 010.51.5 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

25 EPI809/Spring 200825 Interaction Model Relationships Effect (slope) of X 1 on E(Y) does depend on X 2 value E(Y) X1X1X1X1 4 8 12 0 010.51.5 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

26 EPI809/Spring 200826 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

27 EPI809/Spring 200827 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 ^

28 EPI809/Spring 200828 Types of Regression Models

29 EPI809/Spring 200829 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

30 EPI809/Spring 200830 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

31 EPI809/Spring 200831 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.

32 EPI809/Spring 2008 32 Models With One Qualitative Independent Variable

33 EPI809/Spring 200833 Types of Regression Models

34 EPI809/Spring 200834 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)

35 EPI809/Spring 200835 Dummy-Variable Model Worksheet X 2 levels: 0 = Group 1; 1 = Group 2. Run regression with Y, X 1, X 2

36 EPI809/Spring 200836 Interpreting Dummy-Variable Model Equation

37 EPI809/Spring 200837 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                   0 0 1 1 1 1 2 2 2 2 1 1 2 2 0 0 1 1

38 EPI809/Spring 200838 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 0 1 1 1 1 2 2 2 2 1 1 0 0 1 1 1 1 2 2 0 0 1 1 1 1 (0) 2 2 0 0 i i if Female f Male X X   2 2 0 0 1 1

39 EPI809/Spring 200839 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 0 1 1 1 1 2 2 2 2 1 1 0 0 1 1 1 1 2 2 0 0 1 1 1 1 (0) 2 2 0 0 i i if Female f Male X X   2 2 0 0 1 1             Y Y X X X X i i i i i i                    0 0 1 1 1 1 2 2 0 0 1 1 1 1 (1) Females ( ): X X   2 2 1 1      ) 2 2

40 EPI809/Spring 200840 Dummy-Variable Model Relationships Y X1X1X1X1 0 0 Same Slopes  1 0000  0 +  2 ^ ^ ^ ^ Females Males

41 EPI809/Spring 200841 Dummy-Variable Model Example

42 EPI809/Spring 200842 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         3 3 5 5 7 7 0 0 1 1 1 1 2 2 2 2

43 EPI809/Spring 200843 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                   3 3 5 5 7 7 3 3 5 5 7 7 (0) 3 3 5 5 1 1 2 2 1 1 1 1 2 2 0 0 f Male if Female i i X X   0 0 1 1 2 2

44 EPI809/Spring 200844 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                   3 3 5 5 7 7 3 3 5 5 7 7 (0) 3 3 5 5 1 1 2 2 1 1 1 1 2 2 0 0 f Male if Female i i X X   0 0 1 1 2 2 Females   Y Y X X X X i i i i i i           3 3 5 5 7 7 (1) (3 + 7) 5 5 1 1 1 1 ): (X(X (X(X   2 2 1 1

45 EPI809/Spring 200845 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;

46 EPI809/Spring 200846 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


Download ppt "EPI809/Spring 2008 1 Models With Two or More Quantitative Variables."

Similar presentations


Ads by Google