DOE custom design script for arbitrary number of variablesHi,
I like to make a custom DOE design with arbitary number of variables. Below is a test case for 3 varioables and 8 designs.
DOE(
Custom Design,
{
Add Factor( Continuous, 2, 1, "X1", 0 ),
Add Factor( Continuous, 2, 1, "X2", 0 ),
Add Factor( Continuous, 2, 1, "X3", 0 ),
Set Random Seed( 1682521244 ),
Number of Starts( 1 ),
Add Term( {1, 0} ), Add Term( {1, 1} ),
Add Term( {2, 1} ), Add Term( {3, 1} ),
Add Alias Term( {1, 1}, {2, 1} ),
Add Alias Term( {1, 1}, {3, 1} ),
Add Alias Term( {2, 1}, {3, 1} ),
Set Sample Size( 8 ), Simulate Responses( 0 ), Save X Matrix( 0 ), Make Design,Set Run Order(Randomize), Make Table}
);
I appreciate your help. Thanks
Re: DOE custom design script for arbitrary number of variablesThanks Jim. It works fine. I will try the rest of terms and if there any issues, I will let you know.
Thanks again
Re: DOE custom design script for arbitrary number of variablesYou can solve the issue by simply adding in an escape character followed by the " and it will embed the quote within the literal string. \! is the code sequence to indicate an escape character, so \!" will embed the quotation
See below
names = {};
For( i = 1, i <= ncol, i++,
names[i] = Parse( "X" || Char( i ) )
);
AddFactor = {};
ncol = 3;
i = 1;
AddFactor = "Add Factor( Continuous, 2, 1,\!"" || names[i] || "\!" , 0 )";
For( i = 2, i <= ncol, i++,
AddFactor = AddFactor || "," || "Add Factor(Continuous, 2, 1,\!"" || names[i] || "\!", 0)"
);
Eval(
Parse(
obj = "DOE(
Custom Design,
{
" || AddFactor ||
",
Set Random Seed( 1682521244 ),
Number of Starts( 1 ),
Add Term( {1, 0} ), Add Term( {1, 1} ),
Add Term( {2, 1} ), Add Term( {3, 1} ),
Add Alias Term( {1, 1}, {2, 1} ),
Add Alias Term( {1, 1}, {3, 1} ),
Add Alias Term( {2, 1}, {3, 1} ),
Set Sample Size( 8 ), Simulate Responses( 0 ), Save X Matrix( 0 ), Make Design,Set Run Order(Randomize), Make Table}
);"
)
);Re: DOE custom design script for arbitrary number of variablesHi, I started writing a script to automate the DOE table. Here is what I have so far:
names = {};
for (i=1, i<= ncol, i++,
names[i] = Parse(
"X" || char(i));
);
AddFactor = {};
ncol=3;
i=1;
AddFactor = "Add Factor( Continuous, 2, 1," || names[i] ||" , 0 )";
For (i=2, i<= ncol, i++,
AddFactor = AddFactor ||","||"Add Factor(Continuous, 2, 1,||" ||names[i] ||", 0)";
);
Eval(
Parse(
obj = "DOE(
Custom Design,
{
"||AddFactor||",
Set Random Seed( 1682521244 ),
Number of Starts( 1 ),
Add Term( {1, 0} ), Add Term( {1, 1} ),
Add Term( {2, 1} ), Add Term( {3, 1} ),
Add Alias Term( {1, 1}, {2, 1} ),
Add Alias Term( {1, 1}, {3, 1} ),
Add Alias Term( {2, 1}, {3, 1} ),
Set Sample Size( 8 ), Simulate Responses( 0 ), Save X Matrix( 0 ), Make Design,Set Run Order(Randomize), Make Table}
);"
)
);
How do you make A1, A2, and etc as "A1", "A2", and etc. I appreciate your help. Thanks
Re: DOE custom design script for arbitrary number of variablesThanks. The DOE works fine and like to write a script to add more varaibles and etc. I was thinking of using variables names to create a list of
Add Factor( Continuous, 2, 1, "X1", 0 ),
Add Factor( Continuous, 2, 1, "X2", 0 ),
Add Factor( Continuous, 2, 1, "X3", 0 ),
and similarily for
Add Term( {1, 0} ), Add Term( {1, 1} ),
Add Term( {2, 1} ), Add Term( {3, 1} ),
and etc. I am having a bit of problem creating names such as X1, X2 and etc...
I appreciate any help to able to write the script in a more general way. Thanks.
Re: DOE custom design script for arbitrary number of variablesUsing JMP interactively to achieve the result is a good way to start, even if you ultimately want a script. This way you (1) prove the principle and (2) have JMP write the script.
So based on your prototype, the script will iterate over the factors. The DOE() script that you show is an example of an expression in JSL. You can use the Insert Into() function to add more arguments for factors and model terms. When the expression for the DOE() function call is complete, then use the Eval() function to evaluate it.