PSY 652: Research Methods in Psychology I

Interaction with Two Continuous Variables

Kimberly L. Henry: kim.henry@colostate.edu

Risk and Protective Factors

The Risk and Protective Factors Framework is widely used in fields such as public health, psychology, and substance use prevention to understand why some individuals are more likely to engage in risky behaviors (e.g., substance use, violence) while others are not, and what can be done to prevent these behaviors. It focuses on two types of factors:

  • Risk Factors: These are characteristics or conditions that increase the likelihood that a person will engage in risky or unhealthy behaviors.

  • Protective Factors: These are characteristics or conditions that reduce or mitigate the effects of risk factors and decrease the likelihood of engaging in risky behaviors. Protective factors help build resilience and promote positive health outcomes.

A diagram

The data

Press Run Code on the code chunk below to simulate data for this example. We’ll imagine that we have measures of a risk factor, a protective factor, and a health risk behavior for 1000 adolescents randomly selected from the population.

Summary of data

Data summary
Name df
Number of rows 1000
Number of columns 3
_______________________
Column type frequency:
numeric 3
________________________
Group variables None

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
risk_factor 0 1 -0.02 0.96 -3.52 -0.70 -0.05 0.63 3.20 ▁▃▇▅▁
protective_factor 0 1 -0.01 0.99 -3.05 -0.72 -0.01 0.66 3.36 ▁▅▇▃▁
health_risk_behavior 0 1 49.99 7.73 24.80 44.93 49.74 54.89 91.28 ▁▇▆▁▁

The effect of the risk factor

Is the risk factor associated with greater health risk behaviors?

A fitted model for the risk factor

Graph plus equation

\[ \hat{HRB_i} = 50.1 + (4.9 \times RF_i) \]

Fit the moderation model

Is the deleterious effect of the risk factor on the health risk behavior moderated by the protective factor?

How should these effects be interpreted?

HRB = Health Risk Behavior, RF = Risk Factor, PF = Protective Factor

When two variables are specified to interact in a regression model (i.e., \({RF_i}\times{PF_i}\)), that is \(HRB_i\) is regressed on \(RF_i\), \(PF_i\) and their interaction (\(RF_i*PF_i\)), then:

  • The estimate for \(RF_i\) is the effect of the \(RF_i\) on the \(HRB_i\) when \(PF_i\) equals 0.

  • The estimate for \(PF_i\) is the effect of the \(PF_i\) on the \(HRB_i\) when \(RF_i\) equals 0.

  • The estimate for the interaction (\(RF_i*PF_i\)) is the difference in the effect of \(RF_i\) on \(HRB_i\) for a one-unit increase in \(PF_i\).

The interpretations

  • The intercept (50.14) is the predicted health risk behavior score for adolescents who are at the mean in the sample for both the risk factor and the protective factor. (Recall that both the risk and protective factor are z-scores β€” i.e., a mean of 0, and a standard deviation of 1).

  • The estimate for the risk factor (5.11) is the expected change in the health risk behavior for a one-unit increase in the risk factor, among adolescents with a protective factor score of 0 (i.e., average level of protection).

  • The estimate for the protective factor (-2.52) is the expected change in the health risk behavior for a one-unit increase in the protective factor, among adolescents with a risk factor score of 0 (i.e., average level of risk).

  • The estimate for the interaction term (-2.80) is the expected change in the effect of the risk factor on the health risk behavior for a one-unit increase in the protective factor.

Calculation of simple slopes I

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-2.52 \times PF_i) + (-2.80 \times RF_i \times PF_i) \]

What is the effect of the risk factor (RF) on the outcome (HRB) when the protective factor (PF) is at the mean?

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-2.52 \times 0) + (-2.80 \times RF_i \times 0) \]

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) \]

Calculation of simple slopes II

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-2.52 \times PF_i) + (-2.80 \times RF_i \times PF_i) \]

What is the effect of the risk factor (RF) on the outcome (HRB) when the protective factor (PF) is 2 SD below the mean?

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-2.52 \times -2) + (-2.80 \times RF_i \times -2) \] \[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (5.04) + (5.60 \times RF_i) \]

\[ \hat{HRB}_i = 55.18 + (10.71 \times RF_i) \]

Calculation of simple slopes III

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-2.52 \times PF_i) + (-2.80 \times RF_i \times PF_i) \]

What is the effect of the risk factor (RF) on the outcome (HRB) when the protective factor (PF) is 2 SD above the mean?

\[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-2.52 \times 2) + (-2.80 \times RF_i \times 2) \] \[ \hat{HRB}_i = 50.14 + (5.11 \times RF_i) + (-5.04) + (-5.60 \times RF_i) \]

\[ \hat{HRB}_i = 45.10 + (-0.49\times RF_i) \]

Simple slopes with the marginaleffects package

We don’t need to do the calculations ourselves β€” the slopes() function from marginaleffects will do the work for us.

Plotted with the marginaleffects package

Likewise, the plot_predictions() function from the marginaleffects package can be used to plot the simple slopes.

How does the simple slope vary across the range of PF?

We don’t need to pick specific points, we can evaluate the simple slope for the effect of the RF across the entire range of the PF. This is accomplished with the the plot_slopes() function from marginaleffects.

Add our three simple slopes