Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Level I

Next Bext Product in Standard JMP, not Pro



I am using the standard JMP, not the Pro one...

And I would like to build a next best product category model. For example if a customer has bought Product category A, what's the next product they are more likely to purchase Is it feasable in the JMP version I am using? I only have 6 product categories, so nothink like Market Basket Analysis


Your help would be much more appreciated as it is quite urgent.


Thank you so much



Thank You




Staff (Retired)

Re: Next Bext Product in Standard JMP, not Pro

Not sure what the best way is, maybe the contingency platform, but here's an idea:

I'm guessing you don't have enough data on each customer to make a personalized prediction, so this idea uses the data for all the customers to make a guess. I built a table of synthesized data with a sequence of purchases, like this:

Customer purchase dataCustomer purchase data

And make suggestions like this:

last purchase: 1 suggests next purchase: 2
last purchase: 2 suggests next purchase: 3
last purchase: 3 suggests next purchase: 4
last purchase: 4 suggests next purchase: 5
last purchase: 5 suggests next purchase: 6
last purchase: 6 suggests next purchase: 1


totalProds = 6;
maxPurchases = 10;
totalCustomers = 1000;

_p = 1; // customers buy the next product in the sequence 10% of the time and a random product 90% ...
nextprod = Function( {}, // this is a synthetic model, just to have some data to play with
 If( Random Uniform() > .90, // this is a weak relationship
 _p = _p + 1;
 If( _p > totalProds, _p = 1 );//
 , // else
 _p = Random Integer( 1, totalProds )
 Return( _p );

// customers have up to maxPurchases, represented as a list of product numbers (starting at 1)
customerHistory = Function( {},
 {result = {}, i},
 For( i = Random Uniform( 1, maxPurchases ), i > 0, i -= 1,
 Insert Into( result, nextprod() )
 Return( result ); // {4, 5, 5, 1, 2, 4, 4, 6}

// make a customer table with synthetic data
dt = New Table( "Untitled",
 Add Rows( totalCustomers ),
 New Column( "customer", Character, "Nominal", Formula( Right( Char( 1e9 + Row() ), 8 ) ) ),
 New Column( "purchases", Expression, "Nominal", Formula( customerHistory() ) ),


dt << runformulas; // make the table formulas ready
dt:customer << deleteformula; // and remove the formulas
dt:purchases << deleteformula; // in case the table needs sorting, etc

// record every pair of purchaces in a matrix

pairs = J( totalProds, totalProds, 0 );
For( irow = 1, irow <= N Rows( dt ), irow += 1,
 p = dt:purchases[irow]; // p is a list from the data table
 While( N Items( p ) >= 2, // as long as p has at least 2 items
 pairs[p[1], p[2]] += 1; // use the first two as indexes to the pairs matrix
 Remove From( p, 1 ); // remove the first item from p

Show( pairs ); // display the matrix

// sumarize the results
For( i = 1, i <= totalProds, i += 1,
 Write( "\!nlast purchase: ", i, " suggests next purchase: ", Loc Max( pairs[i, 0] ) )

The last line might need a little explanation: pairs[i,0] means row i, all the columns. LocMax is a function that returns the location of the maximum value. Since the product numbers are assigned starting at 1, that location is also the product number that is purchased most often after product i is purchased.



Re: Next Bext Product in Standard JMP, not Pro

What does your data look like? Do you have a "basket" for each customer?


I think a possible simple solution could be to start with each basket as a row of data. Then you would have indicator columns for each product category: 1 = puchased; 0 = not purchased.


Then the multivariate correlations (Analyze > Multivariate Methods > Multivariate) of these indicator variables will tell you about which product categories were purchased together. 

Article Labels

    There are no labels assigned to this post.