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
That's kind of a cool idea for design generation.
I was working on just taking designs from a CSV and generating DOEs. https://community.jmp.com/t5/Byron-Wingerd-s-Blog/Automating-Design-Generation/ba-p/407039
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?
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);
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} )
);