cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lazzybug
Level III

How to use JSL to combine several DoE models into one fit group?

@txnelson @yuichi_katsumur

I have more than 10 individual DoE model in one data table which was generated with stepwise automatically. Next, I want to use JSL to open each DoE model and copy its script inside "fit group( )", followed by ",", so that I can have a combined model. The final format will look like example below. 

 

Fit group(

model 1,

model 2,

model 3,

....

);

 

model 1 = fit model ()

model 2 = fit model ()

 

BTW: Is it possible to get the model effect from DoE script? I also need to change my model to REML if Random Effect of Block is in the effect. Actually I can figure this out if I know how to edit the script with JSL. Thank you so much so much for your help.

 

I actually made some code below already, the only help I need is to remove "\!", and replace the " in the beginning and end from finalmodel variable.

 

Names Default To Here( 1 );
dt = Current Data Table();
jslList = dt << Get Table Script Names;
print (N Items(jslList));
winList = {};
dott = ",";
modeltext = "";
for (i=1, i<=N Items(jslList),i++,
runjsl = dt << Run Script(jslList[i]);
rbiv = runjsl << Report;
rbiv << ShowWindow( 1 );
fitobj = rbiv[outlinebox(1)]<<get scriptable object;
fmscript=char(fitobj<<get script);
modeltext = modeltext || fmscript || dott;
//print(fmscript);
Insert Into(winList, rbiv);
);

for (i=1, i<=N Items(winList), i++,
winList[i] << Close Window();
);

finalmodel = "Fit Group (" || modeltext || ")";
/*finalmodel = Substitute(finalmodel, "\!", "");*/
print (finalmodel);

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to use JSL to combine several DoE models into one fit group?

Hello @lazzybug ,

To remove "\!" you can use parse().

eval (parse(finalmodel));

If you want to run the model in the Fit Group, you need a << run() message.

fmscript=char(fitobj<<get script);
InsertInto(fmScript, Expr("<<Run"));	
modeltext = modeltext || fmscript || dott;

Hope this helps.

View solution in original post

3 REPLIES 3

Re: How to use JSL to combine several DoE models into one fit group?

Hello @lazzybug ,

To remove "\!" you can use parse().

eval (parse(finalmodel));

If you want to run the model in the Fit Group, you need a << run() message.

fmscript=char(fitobj<<get script);
InsertInto(fmScript, Expr("<<Run"));	
modeltext = modeltext || fmscript || dott;

Hope this helps.

Anja_W
Level III

Re: How to use JSL to combine several DoE models into one fit group?

Hello @lazzybug ,

I'm facing a similar problem as you do. I also want to change models, were a block effect was included, to a mixed model from code. Could you provide a minimal example how you achieved this? That would be great!

I also wondered how to loop through a "Fit Group" to access models individually and use the individual models to extract e.g. predictions. 

 

lazzybug
Level III

Re: How to use JSL to combine several DoE models into one fit group?

Hi @Anja_W, it's too complicated to do it. I suggested to reach out JMP experts to solve your problem. Good luck!