Sequence Analysis: Selector and numeric variable
Scenario: Find people who have been to Australia, then the United States, and then Greece, where the cost of the Australian booking is greater than £1000, with a more than 10% increase in the cost of the US booking and then the Greece booking.
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 Selector and Numeric Variables.
-
In the Pattern Definition step:
-
Drag and drop the Destination variable as the selector variable to use.
-
Select Manual from the Pattern definition type drop-down options.
-
Click Set pattern and define the categories you wish to pattern match - here:
-
Click OK and move onto the next step.
-
-
In the Value Definition step:
-
Drag and drop the Cost variable as the numeric variable to use.
-
Select Manual from the Pattern definition type drop-down options.
-
Click Set pattern and define the numeric values you wish to pattern match - here:
For more on the pattern elements you can include when creating sequences on selector and numeric variables see Sequence Analysis: Pattern Definition and Sequence Analysis: Value Definition.
-
Give the pattern a description - here Aus-USA-Greece then OK and Next.
The pattern name of the numeric value must exactly match that used for the selector.
-
-
In the Pattern Return Value step, leave the default settings to select the First - By Start Date and return the Pattern Name on the Grouping Table.
-
Give your expression a meaningful description.
-
In the final step of the wizard, you can review the defined settings. If necessary, navigate back through the steps and edit , or click Finish to create the on the fly aggregation expression.
You can now use the pattern match expression to continue your analysis. For example:
-
Drag and drop the expression onto a new People level selection and enter the pattern Aus-USA-Greece.
Building the selection returns a count of 7 people who currently match the defined pattern
-
Drop a data grid onto the selection and add Booking Date, Destination and Cost.
-
Group by Person URN and build.
-
Sort into ascending order by booking date.
You can see that each person satisfies the pattern by:
-
Having a sequence of bookings that is Australia followed by the United States and then Greece;
-
The cost of the Australian booking being more than £1000;
-
The cost of the US booking being more than 10% higher than the Australian booking;
-
The cost of the Greece booking being more than 10% higher than the US booking,
Related topics: