DM

Lecture_20Video_20W11D2_20-_20Interactions

Introduction

  • Today's topic: Interaction in Regression Analysis

  • Considered the hardest part of the class.

  • Upcoming topics will cover practical applications and logistic regression.

Interactions in Regression

Definition

  • Interaction occurs when the effect of one predictor variable on the response variable depends on the value of another predictor.

  • Contrast with additive model: No interaction means the effects of predictors add up independently.

Example of Interaction

  • Variables: Blood pressure (response), Age, Gender (predictors)

  • No Interaction: Effect of age on blood pressure is the same for males and females (parallel lines).

  • With Interaction: Effect of age on blood pressure is different for males and females (non-parallel lines).

Study Case: Weight Loss Program

Study Design

  • Participants: Males and females were divided into treatment and control groups.

  • Initial average weight was equal in both groups.

Observations

  • After treatment, weight changes differ:

    • Males: Some weight loss.

    • Females: More significant weight loss.

  • Conclusion: Interaction exists between treatment effect and gender; the effect of the treatment depends on gender.

Mathematical Representation of Interaction

Model Structure

  • Include cross product term in the model for interaction.

    • Example predictors: Gender (X1), Treatment (X2).

  • Coefficients:

    • Beta0: Average weight for females in control group (both X1 and X2 are 0).

    • Beta1: Difference in average weight between males and females in the control group.

    • Beta2: Difference in average weight between treatment and control for females.

    • Beta3: Difference in differences, quantifying the interaction effect.

Importance of Interaction Terms

  • Determines how the effect of one predictor varies at different levels of another predictor.

  • If Beta3 is significant, it confirms interaction is present.

Interaction with Categorical and Continuous Variables

Categorical (e.g., Gender) and Continuous (e.g., Age)

  • Separate equations for each category:

    • Plugging in values provides distinct slopes for effects on the response variable.

    • If slopes are equal, indicates no interaction.

Continuous Variables Interaction

  • Collect terms involving predictors to find slopes:

    • Example: Y = Beta0 + Beta1X1 + Beta2X2 + Beta3X1X2

  • Interpretation of slopes depends on the interacting variables.

Importance of Sign and Magnitude of Interaction

Interpreting the Signs

  • Positive or negative signs of interaction terms indicate the type of relationship among predictors and response.

    • Positive interaction: Effect of one variable increases with the value of another.

    • Negative interaction: Effect of one variable decreases with increasing value of another.

Practical Application

Coding in R for Interaction Terms

  • To include interaction in models:

    • Use multiplication (X1*X2) or colon (X1:X2) syntax.

  • Model summary provides coefficients and significance levels for interpretation.

Conclusion

  • Understanding interaction is crucial for accurately modeling relationships in regression analysis.

  • Next session: Discuss practical coding and work through practice problems from the Framingham data.