Sequence Analysis: Numeric variable only

Scenario: Find the longest sequence of holidays a person has made where the cost is decreasing.  Find the start and end numeric values for each sequence.

To get started, launch the Sequence Analysis wizard, then:

  1. Transactional Selection - right click and select the Bookings table as the transactional records to analyse.

  2. Grouping Table - set People as the table to group the bookings up to.

  3. Transaction Grouping - this is an optional step that allows additional grouping into the categories of an identified selector variable. No grouping variable is required here - simply click Next.

  4. Transaction Ordering - in this example:

    1. Drag and drop the Booking Date variable onto the drop-box.

    2. Leave the default order as Earliest to Latest.

    No maximum gap between transactions is necessary here - click Next.

  5. In the Pattern Type step, select Numeric Variable Only.

As this is numeric only pattern matching, you move directly to the Value Definition step.

  1. Drag and drop the Cost variable onto the drop-box, then set the pattern definition type as Longest Decreasing.

  1. Use the Return the drop-down options to define the information you want to return. Here:

    1. Return the Pattern Length

    2. Return as a property on the Grouping Table

  1. Give your pattern match aggregation an appropriate description.

  1. You have the opportunity to review and, if necessary, edit your settings before creating the pattern match expression.

  1. When you click Finish, the pattern match aggregation expression is generated.

For this scenario, to create the two additional pattern match aggregation expressions, you can either use the wizard two more times to follow the same steps but define the return information as Start Numeric Value and End Numeric Value:

Or you can make a copy of this first expression and then:

  1. Click into the aggregation tab at the bottom of the editor window.

  2. Edit the Return the setting.

  3. Rename the aggregation.

  4. Rename the expression.

The expressions can be added as columns on a data grid to display the results for each person.

 

Related topics: