# Using the SPSS Special Syntax for Contrasts

I don’t use SPSS anymore, but recently a colleague asked me about how to perform particular contrasts. I dug up this old post for the purposes of easy access.

I find the documentation for the IBM SPSS SPECIAL contrast documentation not very intuitive… at all. SPSS requires the specification of weights, but in a row wise order (like reading a comic strip)

The script below will perform two orthogonal contrasts (represented in the table below). Firstly, it will test whether Conditions 1 & 2 aggregated ≠ Condition 3; and secondly, whether Condition 1 ≠ 2 (ignoring condition 3).

µ1 | µ2 | µ3 |
---|---|---|

1 | 1 | 1 |

1 | 1 | -2 |

1 | -1 | 0 |

The syntax for this would be as follows:

```
GLM condition1 condition2 condition3
/WSFACTOR=WithinSubjectsVariableName 3 SPECIAL(1 1 1 1 1 -2 1 -1 0)
/METHOD=SSTYPE(3)
/EMMEANS=TABLES(WithinSubjectsVariableName)
/CRITERIA=ALPHA(.05)
/WSDESIGN=WithinSubjectsVariableName.
```

To give an example of this, a colleague recently asked how they could perform a quite complex contrast. They had four conditions, and hypothesised that conditions 1 and 3 would be equivilent, as would 2 and 4.

```
GLM TrustB1 TrustB2 TrustB3 TrustB4
/WSFACTOR=Time 4 SPECIAL(
1 1 1 1
-2 2 -2 2
-2 -1 1 2
0 0 0 0
)
/METHOD=SSTYPE(3)
/CRITERIA=ALPHA(.05)
/WSDESIGN=Time.
```

The first row is just assuming the null (all equal), the last row does nothing. Then the second row is basically just saying let’s compare the -2’s with 2s. 3rd one is a linear contrast. The output of this would give you L1 (second contrast) L2 (third contrast) L3 (fourth contrast), which correspond to row in bit above.

Hope this helps someone out there.