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:
-
Transactional Selection - right click and select the Bookings table as the transactional records to analyse.
-
Grouping Table - set People as the table to group the bookings up to.
-
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.
-
Transaction Ordering - in this example:
-
Drag and drop the Booking Date variable onto the drop-box.
-
Leave the default order as Earliest to Latest.
No maximum gap between transactions is necessary here - click Next.
-
-
In the Pattern Type step, select Numeric Variable Only.
As this is numeric only pattern matching, you move directly to the Value Definition step.
-
Drag and drop the Cost variable onto the drop-box, then set the pattern definition type as Longest Decreasing.
-
Use the Return the drop-down options to define the information you want to return. Here:
-
Return the Pattern Length
-
Return as a property on the Grouping Table
-
-
Give your pattern match aggregation an appropriate description.
-
You have the opportunity to review and, if necessary, edit your settings before creating the pattern match expression.
-
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:
-
Click into the aggregation tab at the bottom of the editor window.
-
Edit the Return the setting.
-
Rename the aggregation.
-
Rename the expression.
The expressions can be added as columns on a data grid to display the results for each person.
Related topics: