cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Not_A_Student
Level II

JSL and DOE[] platform for custom design, can you conditionally 'Add a factor' based on the value of a variable from a modal window ?

Hello,

 

I would like to create  a script, where based on some previous input variable, the DOE[] object is messaged to work with one additional factor.

The DOE design generation is now heavy to run (about a 30sec), so I am looking for a lean way (e.g. tweak it before sending the 'make design' message).

Ideally i would like to work with an if clause, checking if a said boolean variable is true and if so add the factor to the custom design.

 

Some 'pseudocode':

AddSpecialFactor = 1; /* decision rule to add factor, will be retrieved from a modal window based on some more complex molecule chemistry input */

D = DOE(

custom design,

Add Factor(continuous, "A",.....),

Add Factor( ...),

..

If   (AddSpecialFactor = 1) then Add Factor(....),



Add Term(),

..

If (AddSpecialFactor = 1)  then Add Term() ...,

All suggestions are more than welcome

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: JSL and DOE[] platform for custom design, can you conditionally 'Add a factor' based on the value of a variable from a modal window ?

Here is an example of how you might script this process.

 

Names Default to Here( 1 );

dialog = New Window( "Optional Factor", << Modal,
	Outline Box( "Choice",
		Text Box( "Add X4?" ),
		Text Box( "Click OK to add" ),
		Text Box( "Click Cancel to skip" )
	),
	H List Box(
		Button Box( "OK" ),
		Button Box( "Cancel" )
	)
);

doe = DOE( Custom Design,
	{Add Response( Maximize, "Y", ., ., . ),
	Add Factor( Continuous, -1, 1, "X1", 0 ),
	Add Factor( Continuous, -1, 1, "X2", 0 ),
	Add Factor( Continuous, -1, 1, "X3", 0 ), Set Random Seed( 30650037 ),
	Add Term( {1, 0} ), Add Term( {1, 1} ), Add Term( {2, 1} ), Add Term( {3, 1} ),
	Add Term( {1, 1}, {2, 1} ), Add Term( {1, 1}, {3, 1} ),
	Add Term( {2, 1}, {3, 1} ), Set Sample Size( 12 ), Simulate Responses( 0 ),
	Save X Matrix( 0 )}
);

// add 4th factor and the associated main effect and interaction terms
If( dialog["Button"] == 1,
	doe
		<< Add Factor( Continuous, -1, 1, "X4", 0 )
		<< Add Term( {4, 1} )
		<< Add Term( {1, 1}, {4, 1} )
		<< Add Term( {2, 1}, {4, 1} )
		<< Add Term( {3, 1}, {4, 1} )
);

View solution in original post

4 REPLIES 4
Byron_JMP
Staff

Re: JSL and DOE[] platform for custom design, can you conditionally 'Add a factor' based on the value of a variable from a modal window ?

That's kind of a cool idea for design generation.

I was working on just taking designs from a CSV and generating DOEs. Automating Design Generation 

 

It might work to have your script concept generate a data table and then use the script in the blog above to load and run the DOE platform. 

Maybe get a list of column names, and if that list contains certain words, then add columns with the appropriate factor levels?

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
Not_A_Student
Level II

Re: JSL and DOE[] platform for custom design, can you conditionally 'Add a factor' based on the value of a variable from a modal window ?

Thank you Byron,

 

Loading from a table is a nice idea.

Though I have to adjust the model  as it is more complicated as a RSM: it has branching factors as in the publication by Peter Goos and Bradley Jones:

 

Goos and Jones (2019) Optimal Experimental Design in the presence of Nested Factors. Technometrics.

https://doi.org/10.1080/00401706.2018.1562986

 

Do you also have examples where the code is build in text format and then used to an evaluate() expression.

Like:

 

DOECODE = "Part of the code " || if(..,) || etc...
.
.
DOEcommand = evaluate(DOECODE);

DOETable = (DOEcommand << Make Table);

Re: JSL and DOE[] platform for custom design, can you conditionally 'Add a factor' based on the value of a variable from a modal window ?

Here is an example of how you might script this process.

 

Names Default to Here( 1 );

dialog = New Window( "Optional Factor", << Modal,
	Outline Box( "Choice",
		Text Box( "Add X4?" ),
		Text Box( "Click OK to add" ),
		Text Box( "Click Cancel to skip" )
	),
	H List Box(
		Button Box( "OK" ),
		Button Box( "Cancel" )
	)
);

doe = DOE( Custom Design,
	{Add Response( Maximize, "Y", ., ., . ),
	Add Factor( Continuous, -1, 1, "X1", 0 ),
	Add Factor( Continuous, -1, 1, "X2", 0 ),
	Add Factor( Continuous, -1, 1, "X3", 0 ), Set Random Seed( 30650037 ),
	Add Term( {1, 0} ), Add Term( {1, 1} ), Add Term( {2, 1} ), Add Term( {3, 1} ),
	Add Term( {1, 1}, {2, 1} ), Add Term( {1, 1}, {3, 1} ),
	Add Term( {2, 1}, {3, 1} ), Set Sample Size( 12 ), Simulate Responses( 0 ),
	Save X Matrix( 0 )}
);

// add 4th factor and the associated main effect and interaction terms
If( dialog["Button"] == 1,
	doe
		<< Add Factor( Continuous, -1, 1, "X4", 0 )
		<< Add Term( {4, 1} )
		<< Add Term( {1, 1}, {4, 1} )
		<< Add Term( {2, 1}, {4, 1} )
		<< Add Term( {3, 1}, {4, 1} )
);
Not_A_Student
Level II

Re: JSL and DOE[] platform for custom design, can you conditionally 'Add a factor' based on the value of a variable from a modal window ?

Thank you ! 

It works brilliantly