# Obtaining simple main effects comparisons in logistic regression models in SPSS Statistics

## Problem(Abstract)

I'm running a logistic regression model with two categorical predictors and have found that they interact in their effects on the dependent variable. I would like to follow up on interaction by obtaining all pairwise comparisons of each within each level of the other. If this were a linear model, I would be able to use the EMMEANS COMPARE facilities in procedures such as GLM and MIXED, but there doesn't seem to be such an option for logistic regression models in SPSS Statistics. How can I produce such results?

## Resolving the problem

The GENLIN procedure fits generalized linear models and generalized estimating equations. It offers the same capability to fit simple main effects comparisons that exists in GLM and MIXED, using a structure of the form:

/EMMEANS TABLES=A*B COMPARE=A

to get main effects of A within each level of B, including all pairwise comparisons. You can also change the default pairwise comparisons to other types, if desired, using a CONTRAST keyword on the EMMEANS subcommand.

For example, to obtain simple main effects tests and pairwise comparisons for A within each level of B and B within each level of A for a binary logistic regression of variable Y on categorical factors A and B, where the first or lowest value of the dependent variable is to be used as the reference or denominator value in forming logits, you might use the following GENLIN command:

GENLIN Y (REFERENCE=FIRST) BY A B
/MODEL A B A*B
/EMMEANS TABLES=A*B COMPARE=A
/EMMEANS TABLES=A*B COMPARE=B.

GENLIN also offers the ability to compare all of the cells of the A*B design in a pairwise manner, using a structure like:

/EMMEANS TABLES=A*B COMPARE=A*B.

Only pairwise comparisons are available in this situation, but this can be specified completely in the graphical interface, without doing any editing of command syntax.

In releases prior to SPSS 15, using the NOMREG procedure with the TEST subcommand is the easiest way to obtain simple main effects comparisons for logistic regression models. Since NOMREG maintains the canonical overparameterized representation of the model, as opposed to reparameterizing to full rank, as is done in LOGISTIC REGRESSION, specification of simple main effects comparisons can be done in terms of the cells of the design by removing the intercept and main effects from the design. For example, in a 3x3 design, to obtain all pairwise comparisons among the cells involved in simple main effects, you could use (note that the BASE=FIRST ORDER=ASCENDING is not strictly necessary, but is included to make the logit formation the same as in the LOGISTIC REGRESSION procedure):

NOMREG Y (BASE=FIRST ORDER=ASCENDING) BY A B
/MODEL A*B
/INTERCEPT =EXCLUDE
/TEST 'A1 - A2 AT B1' A*B 1 0 0 -1 0 0 0 0 0
/TEST 'A1 - A3 AT B1' A*B 1 0 0 0 0 0 -1 0 0
/TEST 'A2 - A3 AT B1' A*B 0 0 0 1 0 0 -1 0 0
/TEST 'A1 - A2 AT B2' A*B 0 1 0 0 -1 0 0 0 0
/TEST 'A1 - A3 AT B2' A*B 0 1 0 0 0 0 0 -1 0
/TEST 'A2 - A3 AT B2' A*B 0 0 0 0 1 0 0 -1 0
/TEST 'A1 - A2 AT B3' A*B 0 0 1 0 0 -1 0 0 0
/TEST 'A1 - A3 AT B3' A*B 0 0 1 0 0 0 0 0 -1
/TEST 'A2 - A3 AT B3' A*B 0 0 0 0 0 1 0 0 -1
/TEST 'B1 - B2 AT A1' A*B 1 -1 0 0 0 0 0 0 0
/TEST 'B1 - B3 AT A1' A*B 1 0 -1 0 0 0 0 0 0
/TEST 'B2 - B3 AT A1' A*B 0 1 -1 0 0 0 0 0 0
/TEST 'B1 - B2 AT A2' A*B 0 0 0 1 -1 0 0 0 0
/TEST 'B1 - B3 AT A2' A*B 0 0 0 1 0 -1 0 0 0
/TEST 'B2 - B3 AT A2' A*B 0 0 0 0 1 -1 0 0 0
/TEST 'B1 - B2 AT A3' A*B 0 0 0 0 0 0 1 -1 0
/TEST 'B1 - B3 AT A3' A*B 0 0 0 0 0 0 1 0 -1
/TEST 'B2 - B3 AT A3' A*B 0 0 0 0 0 0 0 1 -1 .

## Historical Number

67639

### Document information

More support for: SPSS Statistics

Software version: Not Applicable

Operating system(s): Platform Independent

Reference #: 1481351

Modified date: 07 September 2016