Sequence Analysis: Pattern Definition

In this step, drag and drop your selector variable and choose between a predefined 'Longest' sequence or manually define the required sequence.

If you choose Longest Particular then one of the category codes for that variable must then be selected from the Longest particular value drop-down menu.

When selecting a 'longest' pattern, you can optionally create a list of specific categories to include or exclude. In the Pattern for Destination dialogue, double-click or left-click and drag categories into the Pattern Code List column.

To manually define the pattern:

  1. Select Manual.

  2. Click on the Set pattern button to open the Define pattern dialogue.

  3. Click on the Value column drop-downs to select the variable categories you wish to include in the pattern.

The following positional wildcards are also supported:

? - can represent any single value in that position. Use where the actual value on this element of the pattern is not needed - see screenshot below.
* -

can represent 0 or more values when specifying and finding a desired sequence of transactions.

e.g. that a person should have booked a holiday to Australia first, followed by one to New Zealand; it does not matter how many other bookings fall in between (or if there are none), nor does it matter what the other destinations are – as long as there is a sequence of Australia followed by New Zealand.

= - to match the previous category value in the pattern
<> -

to specify that a category value should be different to the value in the previous record.

e.g. find patterns of transactions where each product is different to the last.

?N - to represent any value the first time it is encountered in the pattern, and then all subsequent references to it must match the same value.

See Expressions: Aggregations On The Fly - Pattern Match Positional Wildcards for more information and examples.

In the case of the above defined settings:

  • Value 1 should be a booking to Australia.

  • Value 2 can be a booking to any destination.

  • Value 3 should be a booking to Greece.

To add an include or exclude list for a manual sequence, use the icons at the bottom of the Define pattern for dialogue:

Once created, grey highlighting indicates that a list is in effect:

When adding an include or exclude categories - these transactions are ones that are included in the set of transactions, but if a value is not in the include list, or is in the exclude list, then the pattern is broken at that point.

 

Click OK to apply the pattern definition and then Next to go to Sequence Analysis: Value Definition