lecture 9 interactions quadratic terms and splines
play

Lecture 9: Interactions, Quadratic terms and Splines Ani - PowerPoint PPT Presentation

Lecture 9: Interactions, Quadratic terms and Splines Ani Manichaikul amanicha@jhsph.edu 30 April 2007 Effect Modification n The phenomenon in which the relationship between the primary predictor and outcome varies across levels of another


  1. Lecture 9: Interactions, Quadratic terms and Splines Ani Manichaikul amanicha@jhsph.edu 30 April 2007

  2. Effect Modification n The phenomenon in which the relationship between the primary predictor and outcome varies across levels of another predictor n We say the other predictor modifies the effect between the primary predictor and outcome n In linear regression, coded by inclusion of interaction term between primary predictor and another predictor

  3. Reminder: Nested models n Parent model n contains one set of variables n Extended model n adds one or more new variables to the parent model n one variable added: compare models with t test n two or more variables added: compare models with F test n Return to the example of wage versus experience

  4. Model 1 = + + ˆ ˆ ˆ � � � E [ Wage ] ( Experience ) ( G ender ) i 0 1 i 2 i n This model allows the average wage to differ for men and women, but the difference in average wage between men and women is always the same regardless of experience level.

  5. Model 1 Source | SS df MS Number of obs = 534 -------------+------------------------------ F( 2, 531) = 61.62 Model | 2651.49936 2 1325.74968 Prob > F = 0.0000 Residual | 11425.1992 531 21.5163827 R-squared = 0.1884 -------------+------------------------------ Adj R-squared = 0.1853 Total | 14076.6985 533 26.4103162 Root MSE = 4.6386 ------------------------------------------------------------------------------ wagehr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- educyrs | .7512834 .0768225 9.78 0.000 .6003701 .9021966 gender | -2.124057 .4028322 -5.27 0.000 -2.915397 -1.332716 _cons | .2178312 1.036322 0.21 0.834 -1.817962 2.253624 ------------------------------------------------------------------------------

  6. Model 2 = + + + × ˆ ˆ ˆ ˆ � � � � E [ Wage ] ( Experience ) ( G ender ) ( G ender Experience ) i 0 1 i 2 i 3 i i n What is the interaction variable??

  7. Model 2: Creating the interaction variable n gender: n 0 for men n 1 for women n gender* experience = 0* experience = 0 for men = 1* experience = experience for women

  8. Model 2: output . generate gender_educ = gender*educ . reg wagehr educyrs gender gender_educ Source | SS df MS Number of obs = 534 -------------+------------------------------ F( 3, 530) = 41.50 Model | 2677.43224 3 892.477414 Prob > F = 0.0000 Residual | 11399.2663 530 21.5080496 R-squared = 0.1902 -------------+------------------------------ Adj R-squared = 0.1856 Total | 14076.6985 533 26.4103162 Root MSE = 4.6377 ------------------------------------------------------------------------------ wagehr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- educyrs | .6831451 .0987423 6.92 0.000 .4891708 .8771194 gender | -4.37045 2.085057 -2.10 0.037 -8.466441 -.2744591 gender_educ | .1725303 .1571232 1.10 0.273 -.1361305 .481191 _cons | 1.104571 1.313655 0.84 0.401 -1.476038 3.685181 ------------------------------------------------------------------------------

  9. Model 2: Interpretation n Equation for men: = ˆ + ˆ � � E [ Wage ] ( Experience ) i 0 1 i = + E [ Wage ] 1 . 10 0 . 68 ( Experience ) i i ( ) ( ) n Equation for women: = + + + ˆ ˆ ˆ ˆ � � � � E [ Wage ] ( Experience ) i 0 2 1 3 i ( ) ( ) = − + + E [ Wage ] 1 . 10 4 . 37 0 . 68 0.17 ( Experience ) i i n � 2 : change in mean wage for women vs. men with no experience n � 3 : change in slope (of experience) for women vs. men

  10. Model 2: Predictions by gender, no experience n Men with no experience = + − + × E [ Wage ] 1 . 10 0 . 68 ( 0) 4.37 ( 0 ) 0 . 17 ( 0 0) i = = ˆ � 1.10 0 n Women with no experience = + − + × E [ Wage ] 1 . 10 0 . 68 ( 0) 4.37 ( 1 ) 0 . 17 ( 1 0) i = = ˆ + ˆ � � 1.10 - 4.37 0 2 ˆ � is the difference in mean wage between n 2 women and men of no experience

  11. Model 2: Predictions by gender, 1 year of experience n Men with 1 year of experience = + − + × E [ Wage ] 1 . 10 0 . 68 ( 1) 4.37 ( 0 ) 0 . 17 ( 0 1) i = + = ˆ + ˆ � � 1.10 0 . 68 0 1 n Women with 1 year of experience = + − + × E [ Wage ] 1 . 10 0 . 68 ( 1) 4.37 ( 1 ) 0 . 17 ( 1 1) i = + + = + + + ˆ ˆ ˆ ˆ � � � � 1.10 0 . 68 - 4.37 0 . 17 0 1 2 3 ˆ + ˆ � � is the difference in mean wage between n 2 3 women and men with one year of experience

  12. Model 2: Predictions by gender, 2 years of experience n Men with 2 years of experience = + − + × E [ Wage ] 1 . 10 0 . 68 ( 2) 4.37 ( 0 ) 0 . 17 ( 0 2) i = + = ˆ + ˆ � � 1.10 0 . 68 ( 2) 2 0 1 n Women with 2 years of experience = + − + × E [ Wage ] 1 . 10 0 . 68 ( 2) 4.37 ( 1 ) 0 . 17 ( 1 2) i = + + = + + + ˆ ˆ ˆ ˆ � � � � 1.10 0 . 68 ( 2) - 4.37 0 . 17 ( 2) 2 2 0 1 2 3 ˆ + ˆ � � is the difference in mean wage 2 n 2 3 between women and men with two years of experience

  13. Model 2: Interpretation � 0 : The average wage for men with no experience n � 1 : The difference in average wage for a one year n increase in experience among men � 2 : The difference in average wage between women n and men with no experience � 3 : The difference of the difference in average n wage for a one year increase in experience between women and men n the change in slope between women and men n the slope for women is � 1 + � 3

  14. Compare to model 1 n In the parent model n � 1 was slope for both men and women n � 2 was difference between women & men at every experience level n In the extended model (with interaction) n � 1 is slope for men n � 2 is difference between women & men for experience= 0 n � 3 is change in slope per year of experience between men & women

  15. Is the change in slope statistically significant? n Test model 1 vs. model 2 n only 1 variable added n use t test for that variable to compare models n H 0 : � 3 = 0 in the population n From the t-statistic, p = 0.27 n Fail to reject H 0 n Conclude that model 1 is better

  16. Model 3: Interaction of two binary predictors n Model 2: n continuous X, binary X, their interaction n slope changes by group n Model 3: n binary X, binary X, their interaction n difference in mean changes by group

  17. Model 3: output Source | SS df MS Number of obs = 534 -------------+------------------------------ F( 3, 530) = 13.94 Model | 1029.58518 3 343.195059 Prob > F = 0.0000 Residual | 13047.1134 530 24.617195 R-squared = 0.0731 -------------+------------------------------ Adj R-squared = 0.0679 Total | 14076.6985 533 26.4103162 Root MSE = 4.9616 ------------------------------------------------------------------------------ wagehr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- gender | -.0951139 .7350696 -0.13 0.897 -1.539121 1.348894 married | 2.521311 .6121088 4.12 0.000 1.318854 3.723768 gender_mar~d | -3.097184 .907319 -3.41 0.001 -4.879567 -1.314802 _cons | 8.354752 .4936948 16.92 0.000 7.384914 9.324591 ------------------------------------------------------------------------------

  18. Model 3: Creating the interaction variable gender: n n 0 for men n 1 for women married: n n 0 if unmarried n 1 if married gender* married n = 0* 0 = 0 for unmarried men = 1* 0 = 0 for unmarried women = 0* 1 = 0 for married men = 1* 1 = 1 for married women

  19. � 3 = Difference of differences Graph for Model 3 Difference Difference = � 2 = � 1 �� 3 12 Difference = � 1 10 � 0 Mean hourly wage 8 6 Difference 4 = � 2 �� 3 2 0 unmarried unmarried married married men women men women

  20. Model 3: Interpretation � 0 : The average wage for unmarried men n � 1 : The difference in average wage between n unmarried women and unmarried men � 1 + � 3 : The difference in average wage between n married women and married men � 3 : The difference of the difference in average n wage between married women and married men and between unmarried women and unmarried men

  21. Model 3: Interpretation � 0 : The average wage for unmarried men n � 2 : The difference in average wage between married n men and unmarried men � 2 + � 3 : The difference in average wage between n married women and unmarried women � 3 : The difference of the difference in average n wage between married women and unmarried women and between married men and unmarried men

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend