# Interaction effect -2nd example

In the original relationship, we have two variables. But we think that a new independent variable moderates the effect that the original independent variable has on the dependent variable. We include an interaction term into the regression because we expect that gender has a different effect on taking part in a demonstration in big cities and small towns. So, here we divide the people into two groups: we will see the effect of gender in 1) big cities and 2) in small towns and we expect that this effect will be different in these two groups.

Note: In this case, you have to use the command COMPUTE and create a new inter variable. In this inter variable we will multiply the two independent variables. (See the syntax.)

weight by pspwght.

fre pbldmn.

RECODE pbldmn (1=1)(2=0) into pbldmn_2cat.

VARIABLE LABELS pbldmn_2cat ‘taking part or not in lawful public demonstration last 12 months?’.

VALUE LABELS pbldmn_2cat 1’yes’ 0’no’.

fre pbldmn pbldmn_2cat.

fre gndr.

RECODE gndr (1=1)(2=0) into gndr_2cat.

VARIABLE LABELS gndr_2cat ‘gender=male’.

VALUE LABELS gndr_2cat 1’male’ 0’female’.

fre gndr gndr_2cat.

fre domicil.

RECODE domicil (1 2=1)(3 thru 5=0) into domicil_2cat.

VARIABLE LABELS domicil_2cat ‘domicil=big city’.

VALUE LABELS domicil_2cat 1’big city or outskirts’ 0’not big city’.

fre domicil domicil_2cat.

fre edulvlb.

RECODE edulvlb (0 thru 213=1)(313 thru 800=0) INTO

edulvlb_primary_dummy.

VARIABLE LABELS edulvlb_primary_dummy ‘Highest education level=primary’.

VALUE LABELS edulvlb_primary_dummy 1’Primary or below’ 0’Higher than primary’.

fre edulvlb edulvlb_primary_dummy.

fre edulvlb.

RECODE edulvlb (313 thru 520=1)(0 thru 213=0)(610 thru 800=0) INTO edulvlb_secondary_dummy.

VARIABLE LABELS edulvlb_secondary_dummy ‘Highest education level=secondary’.

VALUE LABELS edulvlb_secondary_dummy 1’Secondary’ 0’Not secondary’.

fre edulvlb edulvlb_secondary_dummy.

fre edulvlb.

RECODE edulvlb (0 thru 520=0)(610 thru 800=1) INTO edulvlb_tertiary_dummy.

VARIABLE LABELS edulvlb_tertiary_dummy ‘Highest education level=tertiary’.

VALUE LABELS edulvlb_tertiary_dummy 1’Tertiary’ 0’Not tertiary’.

fre edulvlb edulvlb_tertiary_dummy.

LOGISTIC REGRESSION pbldmn_2cat WITH gndr_2cat domicil_2cat edulvlb_secondary_dummy edulvlb_tertiary_dummy.

*============================================.*Another method, without creating the dummy variables manually:.

fre edulvlb.

RECODE edulvlb (0 thru 213=1)(313 thru 520=2)(610 thru 800=3) INTO edulvlb_3cat.

VARIABLE LABELS edulvlb_3cat ‘Highest education level’.

VALUE LABELS edulvlb_3cat 1’Primary or below’ 2’Secondary’ 3’Tertiary’.

fre edulvlb edulvlb_3cat.

LOGISTIC REGRESSION pbldmn_2cat WITH gndr_2cat domicil_2cat edulvlb_3cat

/categorical edulvlb_3cat

/contrast (edulvlb_3cat)=indicator(1).

*/contrast (edulvlb_3cat)=indicator(1). – this means we choose the first category as an indicator category.

*===================================.

*INTERACTION EFFECT.

*1.step) create the variable for the interaction term.

COMPUTE inter_gndr_domicil=gndr_2cat*domicil_2cat.

*2.step) Run the regression.

LOGISTIC REGRESSION pbldmn_2cat WITH gndr_2cat domicil_2cat edulvlb_3cat inter_gndr_domicil

/categorical edulvlb_3cat

/contrast (edulvlb_3cat)=indicator(1).

*/contrast (edulvlb_3cat)=indicator(1). – this means we choose the first category as an indicator category.

Primary or below -> is the reference category (because it is coded with only zeros).

Most of the results, compared to the previous regression table (Education as multicategorical) are similar after we involved the interaction term, but the significance level of the gender changed, it is not significant anymore. (p=0,266)

**Exp(b1):** The odds of taking part in a demonstration among men are 1,615 times as high as among women, everything else held constant. (But this is only true **for small cities**). So, this is the effect of gender in small cities.

The interaction term is only good for the calculation and we only have to check its significance level. In the B column, we have to add the coefficient of the inter variable to the coefficient of the original independent variable called gender (Note: gender appears in the interaction term as well). In the Exp(B) column, we have to multiply them.

**b1+inter:** The log odds of taking part in the demonstration among men is higher by 0,479+0,218=0,697 than among women. This is true for big cities. In this column the effect is additive, so you have to add the two numbers together.

**Exp(b1)*inter:** The odds of taking part in the demonstration among men are 2,007 times as high as among women, but this is true **for big cities**. (So, in the Exp(B) column the effect is multiplicative. This means that you don’t need to add the two numbers together but you have to multiply the two numbers by each other.) 1,615*1,243=2,007. So, this is the effect of gender in big cities.

So, you use the inter variable only for calculations. But you see that the inter variable is not significant, so there is no interaction effect. (p=0,704) This means that the effect of gender is not significantly different in big cities and in small towns. More accurately, we say that we don’t have evidence for stating that there is a significant difference.

UP