cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-481390%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EPlate-forme%20JSL%20et%20DOE%5B%5D%20pour%20la%20conception%20personnalis%C3%A9e%2C%20pouvez-vous%20conditionnellement%20%22Ajouter%20un%20facteur%22%20en%20fonction%20de%20la%20valeur%20d'une%20variable%20%C3%A0%20partir%20d'une%20fen%C3%AAtre%20modale%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-481390%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EBonjour%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJe%20voudrais%20cr%C3%A9er%20un%20script%2C%20o%C3%B9%20bas%C3%A9%20sur%20une%20variable%20d'entr%C3%A9e%20pr%C3%A9c%C3%A9dente%2C%20l'objet%20DOE%20%5B%5D%20est%20envoy%C3%A9%20pour%20fonctionner%20avec%20un%20facteur%20suppl%C3%A9mentaire.%3C%2FP%3E%3CP%3ELa%20g%C3%A9n%C3%A9ration%20de%20conception%20DOE%20est%20maintenant%20lourde%20%C3%A0%20ex%C3%A9cuter%20(environ%2030%20secondes)%2C%20je%20recherche%20donc%20une%20m%C3%A9thode%20all%C3%A9g%C3%A9e%20(par%20exemple%2C%20modifiez-la%20avant%20d'envoyer%20le%20message%20%C2%ABfaire%20la%20conception%C2%BB).%3C%2FP%3E%3CP%3EId%C3%A9alement%2C%20j'aimerais%20travailler%20avec%20une%20clause%20if%2C%20v%C3%A9rifier%20si%20une%20variable%20bool%C3%A9enne%20est%20vraie%20et%2C%20le%20cas%20%C3%A9ch%C3%A9ant%2C%20ajouter%20le%20facteur%20%C3%A0%20la%20conception%20personnalis%C3%A9e.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuelques%20%22pseudocodes%22%3A%3C%2FP%3E%3CPRE%3EAddSpecialFactor%20%3D%201%3B%20%2F*%20decision%20rule%20to%20add%20factor%2C%20will%20be%20retrieved%20from%20a%20modal%20window%20based%20on%20some%20more%20complex%20molecule%20chemistry%20input%20*%2F%0A%0AD%20%3D%20DOE(%0A%0Acustom%20design%2C%0A%0AAdd%20Factor(continuous%2C%20%22A%22%2C.....)%2C%0A%0AAdd%20Factor(%20...)%2C%0A%0A..%0A%0AIf%26nbsp%3B%20%26nbsp%3B(AddSpecialFactor%20%3D%201)%20then%20Add%20Factor(....)%2C%0A%0A%0A%0AAdd%20Term()%2C%0A%0A..%0A%0AIf%20(AddSpecialFactor%20%3D%201)%26nbsp%3B%20then%20Add%20Term()%20...%2C%3C%2FPRE%3E%3CP%3EToutes%20les%20suggestions%20sont%20plus%20que%20bienvenues%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-481390%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EScript%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-482306%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Plate-forme%20JSL%20et%20DOE%5B%5D%20pour%20la%20conception%20personnalis%C3%A9e%2C%20pouvez-vous%20conditionnellement%20%22ajouter%20un%20facteur%22%20en%20fonction%20de%20la%20valeur%20d'une%20variable%20%C3%A0%20partir%20d'une%20fen%C3%AAtre%20modale%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-482306%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EC'est%20une%20bonne%20id%C3%A9e%20pour%20la%20g%C3%A9n%C3%A9ration%20de%20design.%3C%2FP%3E%0A%3CP%3EJe%20travaillais%20simplement%20%C3%A0%20prendre%20des%20conceptions%20%C3%A0%20partir%20d'un%20CSV%20et%20%C3%A0%20g%C3%A9n%C3%A9rer%20des%20DOE.%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FByron-Wingerd-s-Blog%2FAutomating-Design-Generation%2Fba-p%2F407039%22%20target%3D%22_blank%22%3E%20https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FByron-Wingerd-s-Blog%2FAutomating-Design-Generation%2Fba-p%2F407039%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIl%20peut%20%C3%AAtre%20utile%20que%20votre%20concept%20de%20script%20g%C3%A9n%C3%A8re%20une%20table%20de%20donn%C3%A9es%2C%20puis%20utilise%20le%20script%20du%20blog%20ci-dessus%20pour%20charger%20et%20ex%C3%A9cuter%20la%20plate-forme%20DOE.%3C%2FP%3E%0A%3CP%3EPeut-%C3%AAtre%20obtenir%20une%20liste%20de%20noms%20de%20colonnes%2C%20et%20si%20cette%20liste%20contient%20certains%20mots%2C%20ajouter%20des%20colonnes%20avec%20les%20niveaux%20de%20facteur%20appropri%C3%A9s%26nbsp%3B%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-541402%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Plate-forme%20JSL%20et%20DOE%5B%5D%20pour%20la%20conception%20personnalis%C3%A9e%2C%20pouvez-vous%20conditionnellement%20%22ajouter%20un%20facteur%22%20en%20fonction%20de%20la%20valeur%20d'une%20variable%20%C3%A0%20partir%20d'une%20fen%C3%AAtre%20modale%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-541402%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci%20Byron%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELe%20chargement%20%C3%A0%20partir%20d'une%20table%20est%20une%20bonne%20id%C3%A9e.%3C%2FP%3E%3CP%3EBien%20que%20je%20doive%20ajuster%20le%20mod%C3%A8le%20car%20il%20est%20plus%20compliqu%C3%A9%20en%20tant%20que%20RSM%26nbsp%3B%3A%20il%20a%20des%20facteurs%20de%20branchement%20comme%20dans%20la%20publication%20de%20Peter%20Goos%20et%20Bradley%20Jones%26nbsp%3B%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGoos%20et%20Jones%20(2019)%20Conception%20exp%C3%A9rimentale%20optimale%20en%20pr%C3%A9sence%20de%20facteurs%20imbriqu%C3%A9s.%20Technom%C3%A9trie.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdoi.org%2F10.1080%2F00401706.2018.1562986%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdoi.org%2F10.1080%2F00401706.2018.1562986%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAvez-vous%20%C3%A9galement%20des%20exemples%20o%C3%B9%20le%20code%20est%20construit%20au%20format%20texte%2C%20puis%20utilis%C3%A9%20pour%20une%20expression%20d'%C3%A9valuation%20().%3C%2FP%3E%3CP%3EComme%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EDOECODE%20%3D%20%22Part%20of%20the%20code%20%22%20%7C%7C%20if(..%2C)%20%7C%7C%20etc...%0A.%0A.%0ADOEcommand%20%3D%20evaluate(DOECODE)%3B%0A%0ADOETable%20%3D%20(DOEcommand%20%26lt%3B%26lt%3B%20Make%20Table)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-541427%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Plate-forme%20JSL%20et%20DOE%5B%5D%20pour%20la%20conception%20personnalis%C3%A9e%2C%20pouvez-vous%20conditionnellement%20%22ajouter%20un%20facteur%22%20en%20fonction%20de%20la%20valeur%20d'une%20variable%20%C3%A0%20partir%20d'une%20fen%C3%AAtre%20modale%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-541427%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20un%20exemple%20de%20la%20fa%C3%A7on%20dont%20vous%20pourriez%20scripter%20ce%20processus.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20to%20Here(%201%20)%3B%0A%0Adialog%20%3D%20New%20Window(%20%22Optional%20Factor%22%2C%20%26lt%3B%26lt%3B%20Modal%2C%0A%20Outline%20Box(%20%22Choice%22%2C%0A%20%20Text%20Box(%20%22Add%20X4%3F%22%20)%2C%0A%20%20Text%20Box(%20%22Click%20OK%20to%20add%22%20)%2C%0A%20%20Text%20Box(%20%22Click%20Cancel%20to%20skip%22%20)%0A%20)%2C%0A%20H%20List%20Box(%0A%20%20Button%20Box(%20%22OK%22%20)%2C%0A%20%20Button%20Box(%20%22Cancel%22%20)%0A%20)%0A)%3B%0A%0Adoe%20%3D%20DOE(%20Custom%20Design%2C%0A%20%7BAdd%20Response(%20Maximize%2C%20%22Y%22%2C%20.%2C%20.%2C%20.%20)%2C%0A%20Add%20Factor(%20Continuous%2C%20-1%2C%201%2C%20%22X1%22%2C%200%20)%2C%0A%20Add%20Factor(%20Continuous%2C%20-1%2C%201%2C%20%22X2%22%2C%200%20)%2C%0A%20Add%20Factor(%20Continuous%2C%20-1%2C%201%2C%20%22X3%22%2C%200%20)%2C%20Set%20Random%20Seed(%2030650037%20)%2C%0A%20Add%20Term(%20%7B1%2C%200%7D%20)%2C%20Add%20Term(%20%7B1%2C%201%7D%20)%2C%20Add%20Term(%20%7B2%2C%201%7D%20)%2C%20Add%20Term(%20%7B3%2C%201%7D%20)%2C%0A%20Add%20Term(%20%7B1%2C%201%7D%2C%20%7B2%2C%201%7D%20)%2C%20Add%20Term(%20%7B1%2C%201%7D%2C%20%7B3%2C%201%7D%20)%2C%0A%20Add%20Term(%20%7B2%2C%201%7D%2C%20%7B3%2C%201%7D%20)%2C%20Set%20Sample%20Size(%2012%20)%2C%20Simulate%20Responses(%200%20)%2C%0A%20Save%20X%20Matrix(%200%20)%7D%0A)%3B%0A%0A%2F%2F%20add%204th%20factor%20and%20the%20associated%20main%20effect%20and%20interaction%20terms%0AIf(%20dialog%5B%22Button%22%5D%20%3D%3D%201%2C%0A%20doe%0A%20%20%26lt%3B%26lt%3B%20Add%20Factor(%20Continuous%2C%20-1%2C%201%2C%20%22X4%22%2C%200%20)%0A%20%20%26lt%3B%26lt%3B%20Add%20Term(%20%7B4%2C%201%7D%20)%0A%20%20%26lt%3B%26lt%3B%20Add%20Term(%20%7B1%2C%201%7D%2C%20%7B4%2C%201%7D%20)%0A%20%20%26lt%3B%26lt%3B%20Add%20Term(%20%7B2%2C%201%7D%2C%20%7B4%2C%201%7D%20)%0A%20%20%26lt%3B%26lt%3B%20Add%20Term(%20%7B3%2C%201%7D%2C%20%7B4%2C%201%7D%20)%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-541536%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Plate-forme%20JSL%20et%20DOE%5B%5D%20pour%20la%20conception%20personnalis%C3%A9e%2C%20pouvez-vous%20conditionnellement%20%22Ajouter%20un%20facteur%22%20en%20fonction%20de%20la%20valeur%20d'une%20variable%20%C3%A0%20partir%20d'une%20fen%C3%AAtre%20modale%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-541536%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci%20!%3C%2FP%3E%3CP%3ECela%20fonctionne%20%C3%A0%20merveille%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Acara_con_una_leve_sonrisa%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
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  

Recommended Articles