In the following example there are multiple interaction terms in the regression. Here we are going to include an interaction term for the big city and for the education, because we would like to see if there is an interaction between these two variables.

Research question: How does the effect of residence/domicile changes in the categories of the different educations? So, how big is the effect between primary, secondary, and also tertiary educated people?

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.

*===================================.
*INTERACTION EFFECT.
COMPUTE inter_domicil_secondary=domicil_2cat *
edulvlb_secondary_dummy.

COMPUTE inter_domicil_tertiary=domicil_2cat * edulvlb_tertiary_dummy.

LOGISTIC REGRESSION pbldmn_2cat WITH gndr_2cat domicil_2cat edulvlb_secondary_dummy edulvlb_tertiary_dummy inter_domicil_secondary inter_domicil_tertiary.

We need (k-1)*(m-1) interaction terms.

(The number of the categories of the first variable-1)*(The number of categories of the second variable-1)

(2-1)*(3-1)=2 -> so, we will need 2 interaction terms.

2: small city, big city

3: primary, seconday, tertiary

So, we will have to create 2 interaction terms:

big city*secondary education

big city*tertiary education

For primary education, we will not have to create interaction term because that is our reference category, that one we will just leave out of the regression.

So, we will see the interaction differently in secondary and in tertiary education groups.

In conclusion, we can say that there is no evidence for the presence of an interaction effect because the p values of the inter variables are higher than 0,05. So, the effect of domicile in these different categories of education seems to be similar.

UP