cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
dadawasozo
Level IV

Use model script in DOE table but change responses

Hi,

 

I have 10 different DOE tables and each has the DOE  model script. I want to script to use the existing model script in each table and run it with different response column (or replacing the :Y in the model script).

say one of the DOE table is dt and there are added 2 columns into the same table which will be the new responses (Y) for study: col1 and col2. These responses are not in the model script.

How can I modify the below section in script so it will take the input column and run the existing model script to it? is it possible? or I will have to manually go into each DOE table and modify the "Model" script with the 2 responses from col1 and col2?

 

model = dt << Get Property("Model");

Insert Into(model,Expr(Run));

Eval(model);

4 REPLIES 4
ian_jmp
Level X

Re: Use model script in DOE table but change responses

Please find one way:

NamesDefaultToHere(1);

// Example table with saved DOE script
dt = Open("$SAMPLE_DATA/Design Experiment/Custom RSM.jmp");

// Make a new response column with different (random) values
Eval(Column(dt, "Y") << getScript);
Column(dt, "Y 2") << setName("New Y");
Column(dt, "New Y") << setFormula(RandomNormal(0,1));

// Use the saved script with the new response column . . .
modelScript = dt << getScript("Model");									// Get the saved script
RemoveFrom(modelScript, 1);												// Remove the current response definition
InsertInto(modelScript, Expr(Y(:New Y)));								// Add the updated response definition
InsertInto(modelScript, Expr(Run));										// Add the 'Run' directive
modelScript;															// Run the modified script

(Not sure why, but 'SubstituteInto()' had some issues).

 

dadawasozo
Level IV

Re: Use model script in DOE table but change responses

Hi Ian,

the line below actually remove everything (all Effects) in the DOE "model" script .

RemoveFrom (modelscript, 1)

 

Below is example the Model created when I design a DOE. Any way, to remove and replace the :Y with script?

 

Fit Model(
    Effects(
        :A, :B, :A * :B, 
    ), 
    Y( :Y )
);

 

dadawasozo
Level IV

Re: Use model script in DOE table but change responses

Hi Ian,

 

I got it. Just look into the "Model " in the Custom RSM.jmp that you showed here. the Y(:Y) is at the first argument under Fit model. while the Model in my DOE table is second (or last in this case) argument. I think using RemoveFrom (modelscript, 1), will remove the first argument in my "Model", which is Effect. I changed the 1 to -1 and it is working now.

 

Thanks for your help, now I can enable a loop through all the different DOE tables.

 

ian_jmp
Level X

Re: Use model script in DOE table but change responses

Take a look at 'RemoveFrom()' using 'Help > Scripting Index'. If I understand correctly, you could also use:

NamesDefaultToHere(1);

modelScript = Expr(Fit Model(Effects(:A, :B, :A * :B, ), Y( :Y )));
RemoveFrom(modelScript, 2);												// Remove the current response definition
InsertInto(modelScript, Expr(Y(:New Y)));								// Add the updated response definition
InsertInto(modelScript, Expr(Run));										// Add the 'Run' directive
Print(modelScript);