MSDB 720 Lecture 3 part 2: Main Effects and Interaction Models in Computational Sciences

Definition and Context of Main Effects

  • Main Effect Definition: The main effect is the effect of an independent variable on a dependent variable, calculated by averaging across the levels of all other independent variables in the study.

  • Usage Context: This term is frequently employed within the context of factorial designs and regression models. Its primary purpose is to distinguish single-variable effects from interaction effects within a factorial design framework.

Main Effects with One Categorical Variable

  • Graphical Representation (Horizontal Line): If a line representing the factor levels is horizontal (parallel to the x-axis), then no main effect exists. This signifies that the response mean remains identical across all levels of the factor.

  • Graphical Representation (Non-Horizontal Line): If the line is not horizontal, a main effect exists. In this case, the response mean varies across factor levels.

  • Magnitude: The slope of the line determines the magnitude of the main effect.

  • Statistical Significance: While graphical plots provide visual evidence of a main effect, it is mandatory to perform formal statistical tests to evaluate whether the observed effect is statistically significant.

Example: Impact of Teacher Expectations and Student Age on IQ Scores

  • Study Data (Raw Mean IQ Scores):

Teacher Expectations

Student Age: 7 years

Student Age: 15 years

High

115115

110110

Normal

100100

110110

  • Calculating the Main Effect of Teacher Expectations:

    • To find the main effect for the expectation level, average the scores across the age categories.

    • Average for High Expectations: 115+1102=112.5\frac{115 + 110}{2} = 112.5

    • Average for Normal Expectations: 100+1102=105\frac{100 + 110}{2} = 105

  • Calculating the Main Effect of Student Age:

    • To find the main effect for student age, average the scores across the expectation levels.

    • Average for 7-year-olds: 115+1002=107.5\frac{115 + 100}{2} = 107.5

    • Average for 15-year-olds: 110+1102=110\frac{110 + 110}{2} = 110

Understanding Interactions

  • Core Definition: An interaction occurs when the independent variable has a different effect on the outcome (dependent variable) depending on the specific value or level of another independent variable.

  • Interaction between a Continuous and Categorical Variable:

    • Scenario: Studying the amount of cholesterol lowering (mg/dlmg/dl) based on drug dose (continuous) and sex (categorical: Male vs. Female).

    • Model without Interaction:

      • Y=α+β1×dose+β2×sex+(0×dose×sex)Y = \alpha + \beta_1 \times \text{dose} + \beta_2 \times \text{sex} + (0 \times \text{dose} \times \text{sex})

      • Graphically, this is represented by two parallel lines for Males and Females. The effect of the dose is the same for both groups.

    • Model with Interaction:

      • Y=α+β1×dose+β2×sex+β3×dose×sexY = \alpha + \beta_1 \times \text{dose} + \beta_2 \times \text{sex} + \beta_3 \times \text{dose} \times \text{sex}

      • Graphically, the lines for Males and Females are not parallel. They may diverge or converge, indicating that the drug's effectiveness depends on the sex of the individual.

Interactions between Two Continuous Variables

  • Mathematical Model:

    • Y=α+β1×dose+β2×age+(β3×dose×age)Y = \alpha + \beta_1 \times \text{dose} + \beta_2 \times \text{age} + (\beta_3 \times \text{dose} \times \text{age})

  • Variable Effects:

    • When an interaction term is present, the effect of one variable that forms the interaction depends on the level of the other variable.

    • Effect of Dose: For a fixed value of age (e.g., age0\text{age}_0), the effect of the dose on YY is given by the derivative/slope: β1+β3×age0\beta_1 + \beta_3 \times \text{age}_0.

    • Effect of Age: For a fixed value of dose (e.g., dose0\text{dose}_0), the effect of age on YY is given by: β2+β3×dose0\beta_2 + \beta_3 \times \text{dose}_0.

  • Dichotomization for Visualization: Continuous variables like age are sometimes split into categories (e.g., "Young," "Middle," "Old") to visualize how the slope of the drug dose changes across different life stages.

Interactions between Two Categorical Variables

  • Example Scenario: Testing two medications (Med A and Med B) across two sexes (Male and Female).

  • Coding Example:

    • Med A = 00, Med B = 11

    • Male = 00, Female = 11

  • The interaction would measure if Med B is more effective for Females than for Males, relative to Med A.

Procedural Steps for Data Analysis with Interactions

  1. Data Preparation: Enter data and create new variables to represent all interactions. This includes all possible two-by-two interaction terms and the single interaction term combining all variables (if applicable).

  2. Descriptive Statistics: Review descriptive statistics for all data points.

  3. Visualization: Examine scatter plots for every variable.

  4. Correlation Analysis: Calculate a correlation matrix for all included variables.

  5. Simple Linear Regression: Perform a simple linear regression for each individual variable.

  6. Multiple Linear Regression (Base): Calculate multiple linear regression involving all variables without interactions.

  7. Interaction Modeling: Systematically add various interactions to observe changes in the model.

  8. Final Synthesis: Draw overall conclusions based on the totality of evidence gathered from all models.

Quantitative Model Comparison: UN11 Dataset (Life Expectancy)

Model 1: Interaction Model

Equation Structure: lifeExpFgroup×log(ppgdp)\text{lifeExpF} \sim \text{group} \times \log(\text{ppgdp})

Variable

Estimate (β\beta)

Std. Error

t-Value

Pr(>

t

)

(Intercept) β0\beta_0

59.213759.2137

15.220315.2203

3.893.89

0.00010.0001



other β02\beta_{02}

11.1731-11.1731

15.594815.5948

0.72-0.72

0.47460.4746



africa β03\beta_{03}

22.9848-22.9848

15.783815.7838

1.46-1.46

0.14700.1470



log(ppgdp)\log(\text{ppgdp}) β1\beta_1

1.55441.5544

1.01651.0165

1.531.53

0.12780.1278



other:log(ppgdp)\log(\text{ppgdp}) β12\beta_{12}

0.64420.6442

1.05201.0520

0.610.61

0.54100.5410



africa:log(ppgdp)\log(\text{ppgdp}) β13\beta_{13}

0.75900.7590

1.09411.0941

0.690.69

0.48870.4887



  • Residual Standard Error: 5.12935.1293 with 193193 df.

  • R-squared (R2R^2): 0.74980.7498.

Model 2: Main Effect Model

Equation Structure: E(lifeExpFlog(ppgdp)=x,group)=β0+β02U2+β03U3+β1xE(\text{lifeExpF} | \log(\text{ppgdp}) = x, \text{group}) = \beta_0 + \beta_{02}U_2 + \beta_{03}U_3 + \beta_1 x

Variable

Estimate (β\beta)

Std. Error

t-value

Pr(>

t

)

(Intercept) β0\beta_0

49.529249.5292

3.39963.3996

14.5714.57

0.00000.0000



other β02\beta_{02}

1.5347-1.5347

1.17371.1737

1.31-1.31

0.19260.1926



africa β03\beta_{03}

12.1704-12.1704

1.55741.5574

7.81-7.81

0.00000.0000



log(ppgdp)\log(\text{ppgdp}) β1\beta_1

2.20242.2024

0.21900.2190

10.0610.06

0.00000.0000



  • Residual Standard Error: 5.17985.1798 with 195195 df.

  • R-squared (R2R^2): 0.74220.7422.

Relationship Between Main Effects and Interactions

  • Independence: Main effects and interactions are independent of each other.

  • Possible Combinations:

    • Main effects without interactions.

    • Interactions without main effects.

    • Both main effects and interactions.

    • Neither main effects nor interactions.

  • Graphical Identification:

    • Interactions: The less parallel the lines are on a graph, the more likely there is a significant interaction. A "crossover interaction" occurs when the lines intersect.

    • Main Effects: On a graph with two groups (e.g., represented by black diamonds and open circles), the main effect is determined by whether one group is, in general, higher or lower than the other group across the x-axis.

    • Parallel Lines: If lines are perfectly parallel, there is no interaction, but there may still be significant main effects for either or both variables.