<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Mixture design point type (extrem vertices) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479558#M72386</link>
    <description>&lt;P&gt;No problem. I can't take credit for writing the script but recall it being shared with me quite a few years ago. I believe it was embedded in the JMP course notes on Mixture Designs and could have been Mark Bailey.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Apr 2022 16:04:48 GMT</pubDate>
    <dc:creator>louv</dc:creator>
    <dc:date>2022-04-15T16:04:48Z</dc:date>
    <item>
      <title>Mixture design point type (extrem vertices)</title>
      <link>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479491#M72370</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Is there a way to know whether a mixture design point is a vertice or a centroid (of degree 1, or 2, or 3, ...) when creating an Extrem Vertices Design?&lt;/P&gt;&lt;P&gt;Ideally, I wish it could be indicated in an additional column in the "Make Design" Table.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 21:09:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479491#M72370</guid>
      <dc:creator>dp30</dc:creator>
      <dc:date>2023-06-08T21:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Mixture design point type (extrem vertices)</title>
      <link>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479514#M72373</link>
      <description>&lt;P&gt;Check out this script to see if it is what you were looking for?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

Ntables = N Table();
tableList = {};
For( i = 1, i &amp;lt;= Ntables, i++,
	tableList[i] = Data Table( i )
);
//show(tableList);

desTable = {};
conTable = {};

sameTableAlert = Expr(
	Dialog(
		"Choose different data tables for each selection.",
		Text Box( " " ),
		Button( "OK" )
	)
);

noTableAlert = Expr(
	Dialog(
		"A design data table must be open.",
		Text Box( " " ),
		Button( "OK" )
	)
);

noMixtureFacAlert = Expr(
	Dialog(
		"The Design Table has no mixture factors.",
		Text Box( " " ),
		Button( "OK" )
	)
);

doWork = Expr(
//Assess the Design Table
	numCols = N Col( desTable );
	numRows = N Row( desTable );
	numMixFac = 0;
	XMatrix = [];
	mixLower = [];
	mixUpper = [];
	mixSum = [];
	mixCon = [];
//show(numCols);
	//show(numRows);
	Current Data Table( desTable );
	For( i = 1, i &amp;lt;= numCols, i++,
		col = Column( i );
		prop = col &amp;lt;&amp;lt; get property( "Mixture" );
//show(prop);
		If( Is List( prop ),
			numMixFac++;
			tmp = col &amp;lt;&amp;lt; get as matrix;
//show(tmp);
			XMatrix ||= tmp;
//show(XMatrix);
			mixLower ||= {prop[1]};
			mixUpper ||= {prop[2]};
			mixSum ||= {prop[3]};
//show(numMixFac);
		);
	);
	If( numMixFac == 0,
		noMixtureFacAlert,
		satCon = J( numRows, 1, 0 );
//show(satCon);

		//Set up Simple Constraint Matrix
		numConstraintsOld = 2 * numMixFac + 1;
		conMatrix = J( 1, numMixFac, 1 );
		conMatrix = conMatrix |/ Identity( numMixFac ) |/
		Identity( numMixFac );
//show(conMatrix);

		mixSumVal = mixSum[1];
		mixCon = mixCon || {mixSumVal} || mixLower || mixUpper;
//show(mixCon);

		//Get linear inequality constraints if there is a constraint table
		If( conVal == 1,
			numConstraintsNew = numConstraintsOld;
			Current Data Table( conTable );
			numIneqRow = N Row( conTable );
//look for duplicate constraints
			FullConMat = conMatrix || mixCon`;
			For( i = 1, i &amp;lt;= numIneqCon, i++,
				con = Column( i );
				prop = con &amp;lt;&amp;lt; get property( "ConstraintState" );
				charprop = Char( Name Expr( prop ) );
				If( numIneqRow != numMixFac + 1,
					Throw(
						"Can only use constraints with pure mixture designs."
					)
				);
				ineqConMat = con &amp;lt;&amp;lt; get as matrix;
//show(ineqConMat);
				overallTest = 0;
				For( j = 1, (j &amp;lt;= numConstraintsOld), j++, &amp;nbsp;
//find the first nonzero element
					For( k = 1, k &amp;lt;= numMixFac + 1, k++,
						If( FullConMat[j, k] != 0,
							piv = FullConMat[j, k];
							ind = k;
							k = numMixFac + 2;
						)
					);
					test = 0;
					If( ineqConMat[ind] != 0,
						mult = piv / ineqConMat[ind];
						newRow = ineqConMat * mult;
						newRow = newRow` - FullConMat[j, 0];
						For( k = 1, k &amp;lt;= numMixFac + 1, k++,
							If( Abs( newRow[k] ) &amp;gt; 1e-10,
								test
								++)
						);
					,
						test
						++);
					If( test == 0,
						overallTest++;
						j = numConstraintsOld + 1;
					);
				);

//show(overallTest);
				If( overallTest == 0,
					tmp = ineqConMat[1 :: numMixFac];
					conMatrix = conMatrix |/ tmp`;
					numConstraintsNew++;
					tmp = ineqConMat[numMixFac + 1 :: numMixFac + 1];
					mixCon = mixCon || tmp;
				);
//show(mixCon);
			);
		,
			numConstraintsNew = numConstraintsOld
		);
//show(conMatrix);

		//Check how the rows satisfy the constraints
		resultMat = conMatrix * XMatrix`;
//show(resultMat);
		For( j = 1, j &amp;lt;= numRows, j++,
			For( i = 1, i &amp;lt;= numConstraintsNew, i++,
				If( Abs( resultMat[i, j] - mixCon[i] ) &amp;lt; .00000001,
					satCon[j, 1]
					++)
			)
		);
//show(satCon);

		//label the points
		Current Data Table( desTable );
		pointCol = desTable &amp;lt;&amp;lt; New Column( "Point Type", Character, Nominal );
		For( i = 1, i &amp;lt;= numRows, i++,
			If(
				(satCon[i] &amp;gt;= numMixFac),
					pointCol[i] = "Vertex";
					Row State( i ) = Color State( 3 );,
				(satCon[i] == numMixFac - 1),
					pointCol[i] = "Edge";
					Row State( i ) = Color State( 4 );,
				(satCon[i] == 1),
					pointCol[i] = "Interior";
					Row State( i ) = Color State( 5 );,
				numFace = numMixFac - satCon[i];
				pointCol[i] = Char( numFace ) || "D-Face";
				Row State( i ) = Color State( numMixFac - satCon[i] + 6 );
			)
		);
		pointCol &amp;lt;&amp;lt; label( 1 );
//Create Ternary Plot Script
		xString = "";
		For( i = 1, i &amp;lt;= numCols, i++,
			col = Column( i );
			prop = col &amp;lt;&amp;lt; get property( "Mixture" );
			If( Is List( prop ),
				colname = Char( Column Name( i ) );
//show(colname);
				xString = xString || Expr( " :" ) || colname || Expr( "," );
			);
		);
		len = Length( xString );
		xString2 = Substr( xString, 1, len - 1 );
//show(xString2);

		If( numMixFac &amp;gt; 2,
			frameString = "";
			If( numMixFac == 3,
				frameString = frameString || "report(obj)[framebox(" ||
				Char( 1 ) || ")]&amp;lt;&amp;lt;marker size(4);",
				numPlots = (numMixFac * (numMixFac - 1)) / 2;
				For( i = 1, i &amp;lt; numPlots, i++,
					frameString = frameString || "report(obj)[framebox(" ||
					Char( i ) || ")]&amp;lt;&amp;lt;marker size(4);\!N"
				);
				frameString = frameString || "report(obj)[framebox(" ||
				Char( i ) || ")]&amp;lt;&amp;lt;marker size(4);";
			);

			d1 = "obj=Ternary Plot(Y(" || xString2 || "));\!N" || frameString;
			d2 = Eval( Expr( Parse( d1 ) ) );
			d3 = Expr(
				desTable &amp;lt;&amp;lt; New Table Property( "Ternary Plot", a )
			);
			Eval( Substitute( Name Expr( d3 ), Expr( a ), Name Expr( d2 ) ) );
		);
		If( NTables &amp;gt; 1,
			dlg &amp;lt;&amp;lt; close window
		);
	);
);

initState = 0;
If(
	(Ntables == 0), noTableAlert,
	(Ntables == 1),
		conVal = 0;
		desTable = tableList[1];
		doWork;,
	dlg = New Window( "Identify Mixture Points",
		Border Box( Left( 3 ), bottom( 3 ), Right( 2 ), sides( 28 ), top( 3 ),
			V List Box(
				Panel Box( "Table Settings",
					checkObj = Check Box(
						{"Use Constraint Table"},
						If( initState == 0,
							pbox &amp;lt;&amp;lt; append(
								pbox2 =
								Panel Box( "Select Constraint Data Table",
									comboObj3 = Combo Box( tableList )
								)
							);
							pbox &amp;lt;&amp;lt; reshow;
						,
							pbox2 &amp;lt;&amp;lt; delete;
							pbox &amp;lt;&amp;lt; reshow;
						);
						If( initState == 0,
							initState = 1,
							initState = 0
						);
					)
				),
				pbox = Panel Box( "Select Data Tables",
					Panel Box( "Select Design Data Table",
						comboObj1 = Combo Box( tableList )
					), 

				),
				Button Box( "OK",
					desTableNum = comboObj1 &amp;lt;&amp;lt; get;
//show(desTableNum);
					desTable = Data Table( Eval( desTableNum ) );
//show(desTable);
					conVal = checkObj &amp;lt;&amp;lt; get( 1 );
					If( (conVal == 1) &amp;amp; (Ntables == 1),
						Throw(
							"Both a design and constraint table must be open."
						)
					);
					If( conVal == 1,
						conTableNum = comboObj3 &amp;lt;&amp;lt; get;
//show(conTableNum);
						conTable = Data Table( Eval( conTableNum ) );
//show(conTable);
					);
					If( (conVal == 1) &amp;amp; (desTableNum == conTableNum),
						sameTableAlert,
						If( conVal == 1,
							Current Data Table( conTable );
							numIneqCon = N Col( conTable );
							For( i = 1, i &amp;lt;= numIneqCon, i++,
								con = Column( i );
								prop = con &amp;lt;&amp;lt;
								get property( "ConstraintState" );
								charprop = Char( Name Expr( prop ) );
								If(
									(charprop != "ConstraintState(less than)")
									 &amp;amp; (charprop !=
									"ConstraintState(greater than)"),
									Throw( "Need to use a constraint table." )
								);

							);
						);
						doWork;
					);
				)
			)
		)
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 13:05:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479514#M72373</guid>
      <dc:creator>louv</dc:creator>
      <dc:date>2022-04-15T13:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Mixture design point type (extrem vertices)</title>
      <link>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479522#M72377</link>
      <description>&lt;P&gt;Wow !&amp;nbsp;Exactly what I was looking for, thanks a lot !&lt;/P&gt;&lt;P&gt;It works perfectly, that's a great script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 12:25:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479522#M72377</guid>
      <dc:creator>dp30</dc:creator>
      <dc:date>2022-04-15T12:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Mixture design point type (extrem vertices)</title>
      <link>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479558#M72386</link>
      <description>&lt;P&gt;No problem. I can't take credit for writing the script but recall it being shared with me quite a few years ago. I believe it was embedded in the JMP course notes on Mixture Designs and could have been Mark Bailey.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Apr 2022 16:04:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Mixture-design-point-type-extrem-vertices/m-p/479558#M72386</guid>
      <dc:creator>louv</dc:creator>
      <dc:date>2022-04-15T16:04:48Z</dc:date>
    </item>
  </channel>
</rss>

