Subscribe Bookmark RSS Feed

Save Choice Utilities to a Table Using JSL

JoyLaneResearch

New Contributor

Joined:

Oct 18, 2017

Need to run several choice models using different profiling variables and save the utilites from each run into a table for later comparison and modeling. For example, let's say I need to run the pizza choice model against gender and save utilities for all the attributes for men and for women. 

 

I can create the JSL needed to run all the models, but don't see how to batch save the utilities from them using JSL. Has anyone tried this and succeeded? Any examples or snippets of JSL - even generic ones - would be greatly appreciated! Thanks!

3 REPLIES
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

https://community.jmp.com/t5/Discussions/Scripting-a-JMP-Journal/td-p/14462

Are you referring to saving the reports or analysis results to a journal ? If yes the above discussion has what you need . else , can you provide an example as to what you mean when you say utilities
Best
Uday
JoyLaneResearch

New Contributor

Joined:

Oct 18, 2017

Using the jmp Pizza example, I'm trying to capture the utilities from multiple runs with and without demographic variables into one file for further analysis. At this point, I can manually use "Save Utility Formula" in the Choice Model dialog to create these for each run of the experiment. (See image.)PizzaUtilities.PNG

 

 

 

What I hope to do is automate the process with JSL of running all the experiments I need (dozens of them) and collecting the utilities into one table, like the one below (which I assembled manually in Excel).Pizza Utilities Combined.PNG

 

 

Where I run into difficulty is in getting all this into one table during calculation of the corresponding  choice models.

 

Oh, and there's one more thing. Notice in the top picture the rows highlighted in the model without versus the model with gender included. Shouldn't the utility for the combined row be somewhere between the utilities for the corresponding rows with genders broken out?

 

txnelson

Super User

Joined:

Jun 22, 2012

Might this be the kind of thing you are looking for:

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Pizza Responses.jmp" );
Open( "$SAMPLE_DATA/Pizza Subjects.jmp" );
dt = Data Table( "Pizza Profiles" );

ch = dt << Choice(
	Response DataTable( Pizza Responses ),
	Profile DataTable( Pizza Profiles ),
	Subject DataTable( Pizza Subjects ),
	Response Profile ID Chosen( :Choice ),
	Response Subject ID( :Subject ),
	Response Profile ID Choices( :Choice1, :Choice2 ),
	Profile ID( :ID ),
	Profile Effects( :Crust, :Cheese, :Gender ),
	Subject Subject ID( :Subject ),
	Subject Effects( :Gender )
);
ch << save utility formula;
dt1 = Current Data Table();
ch << close window;

ch = dt << Choice(
	Response DataTable( Pizza Responses ),
	Profile DataTable( Pizza Profiles ),
	Subject DataTable( Pizza Subjects ),
	Response Profile ID Chosen( :Choice ),
	Response Subject ID( :Subject ),
	Response Profile ID Choices( :Choice1, :Choice2 ),
	Profile ID( :ID ),
	Profile Effects( :Crust, :Cheese ),
	Subject Subject ID( :Subject ),
	Subject Effects( :Gender )
);
ch << save utility formula;
dt2 = Current Data Table();
ch << close window;
dt1 << concatenate( dt2, append to first table( 1 ) );
Close( dt2, nosave );

 choice.PNG

Jim