<?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: How to record the classification of data points within ellipses in a Scatter Plot Matrix after clustering? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-record-the-classification-of-data-points-within-ellipses/m-p/809680#M99075</link>
    <description>&lt;P&gt;It seems like normal mixtures platform might be using it's own scatterplot matrix which isn't that easy to access or manipulate. You could save the clusters to your table and then use Scatterplot Matrix to create the plot&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Scatterplot Matrix(
	Y(:height, :weight),
	Group(:Cluster),
	Matrix Format("Lower Triangular"),
	Density Ellipses(1),
	Ellipses Coverage(0.4),
	Group By(:Cluster)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but this won't let you get the points. To get this you can use Fit Y by X platform (use cluster as By column).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1730821471135.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69835iB751EE95139BE7EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1730821471135.png" alt="jthi_0-1730821471135.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is one place where I know you can select the points inside of the ellipses&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1730821494306.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69836iFD1341250E57B136/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1730821494306.png" alt="jthi_1-1730821494306.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As I'm not really sure what you are trying to do (are you just trying to select the points or also have some sort of a report) below is script which does a lot of things&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("",
	vlb = V List Box(
		nm = dt &amp;lt;&amp;lt; Normal Mixtures(
			Y(:height, :weight),
			{Mixtures Tolerance(0.00000001), Mixtures MaxIter(300), Mixtures N Starts(30),
			Outlier Cluster(0), Diagonal Variance(0), Number of Clusters(2), Go()}
		)
	)
);

cols = Associative Array(dt &amp;lt;&amp;lt; Get Column Names("String"));
nm &amp;lt;&amp;lt; Save Clusters;
cluster_col = Associative Array(dt &amp;lt;&amp;lt; Get Column Names("String"));
cluster_col &amp;lt;&amp;lt; Remove(cols);
cluster_col = (cluster_col &amp;lt;&amp;lt; get keys)[1];

vlb &amp;lt;&amp;lt; Append(
	sm = dt &amp;lt;&amp;lt; Scatterplot Matrix(
		Y(:height, :weight),
		Group(:Cluster),
		Matrix Format("Lower Triangular"),
		Shaded Ellipses(1),
		Ellipses Coverage(0.4),
		Group By(Eval(cluster_col))
	);
);

biv = dt &amp;lt;&amp;lt; Bivariate(Y(:weight), X(:height), By(:Cluster), Invisible);
biv &amp;lt;&amp;lt; Density Ellipse(0.4, {Select Points Inside});

new_col = dt &amp;lt;&amp;lt; New Column("Ellipse", Numeric, Nominal, Formula(
	If(Selected() &amp;amp; :Cluster == 1,
		1
	, Selected() &amp;amp; :Cluster == 2,
		-1
	,
		0
	)
));
dt &amp;lt;&amp;lt; run formulas;
new_col &amp;lt;&amp;lt; Delete Formula;
dt &amp;lt;&amp;lt; clear select;

// Just for visualization purposes
gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(653, 491),
	Show Control Panel(0),
	Variables(
		X(:height),
		Y(:weight),
		Overlay(:Cluster, Overlay Encoding("Style")),
		Color(:Ellipse)
	),
	Elements(Points(X, Y, Legend(3)))
);

For(i = 1, i &amp;lt;= 2, i++,
	ls = Report(biv[i])[FrameBox(1)] &amp;lt;&amp;lt; Find Seg(LineSeg(1));
	xs = ls &amp;lt;&amp;lt; Get X Values;
	ys = ls &amp;lt;&amp;lt; Get y Values;
	Eval(EvalExpr(
		Report(gb)[FrameBox(1)] &amp;lt;&amp;lt; Add Graphics Script(
			Line(Expr(xs), Expr(ys));
		)		
	));
);
//biv &amp;lt;&amp;lt; close window;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_4-1730822895958.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69840i94368981E7829274/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_4-1730822895958.png" alt="jthi_4-1730822895958.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_5-1730822903982.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69841i7D9930D190FF2CAA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_5-1730822903982.png" alt="jthi_5-1730822903982.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Nov 2024 16:08:31 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-11-05T16:08:31Z</dc:date>
    <item>
      <title>How to record the classification of data points within ellipses in a Scatter Plot Matrix after clustering?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-record-the-classification-of-data-points-within-ellipses/m-p/809192#M98882</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The following JSL code can be used to display a ScatterPlot Matrix after Clustering.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open("$SAMPLE_DATA/Big Class.jmp");

Normal Mixtures(
	Y( :height, :weight ),
	{Mixtures Tolerance( 0.00000001 ), Mixtures MaxIter( 300 ),
	Mixtures N Starts( 30 ), Outlier Cluster( 0 ), Diagonal Variance( 0 ),
	Number of Clusters( 2 ), Go( Scatterplot Matrix( Ellipse Alpha( 0.1 ) ) )},
	SendToReport(
		Dispatch( {"Normal Mixtures NCluster=2"}, "Correlations for Normal Mixtures",
			OutlineBox,
			{Close( 0 )}
		),
		Dispatch( {"Normal Mixtures NCluster=2", "Scatterplot Matrix"}, "101",
			ScaleBox,
			{Min( 59.68 ), Max( 179.498666666667 ), Inc( 20 ), Minor Ticks( 0 )}
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;I need assistance with the following two questions:&lt;BR /&gt;(1) How can I set the Ellipse α to 0.4 in the JSL code?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BabyDoragon_0-1730254787826.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69646iCAB11F5931D8CD4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BabyDoragon_0-1730254787826.png" alt="BabyDoragon_0-1730254787826.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;(2) I would like to record the points included in the Ellipse with an α of 0.4, where the points within the red Ellipse are labeled as 1, those within the green Ellipse are labeled as -1, and the points outside both Ellipses are labeled as 0. This is similar to saving clusters in a Table, but instead, I want to record the points included in the Ellipses. How can I add this functionality to the JSL code?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 02:23:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-record-the-classification-of-data-points-within-ellipses/m-p/809192#M98882</guid>
      <dc:creator>BabyDoragon</dc:creator>
      <dc:date>2024-10-30T02:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to record the classification of data points within ellipses in a Scatter Plot Matrix after clustering?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-record-the-classification-of-data-points-within-ellipses/m-p/809680#M99075</link>
      <description>&lt;P&gt;It seems like normal mixtures platform might be using it's own scatterplot matrix which isn't that easy to access or manipulate. You could save the clusters to your table and then use Scatterplot Matrix to create the plot&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Scatterplot Matrix(
	Y(:height, :weight),
	Group(:Cluster),
	Matrix Format("Lower Triangular"),
	Density Ellipses(1),
	Ellipses Coverage(0.4),
	Group By(:Cluster)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but this won't let you get the points. To get this you can use Fit Y by X platform (use cluster as By column).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1730821471135.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69835iB751EE95139BE7EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1730821471135.png" alt="jthi_0-1730821471135.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is one place where I know you can select the points inside of the ellipses&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1730821494306.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69836iFD1341250E57B136/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1730821494306.png" alt="jthi_1-1730821494306.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As I'm not really sure what you are trying to do (are you just trying to select the points or also have some sort of a report) below is script which does a lot of things&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("",
	vlb = V List Box(
		nm = dt &amp;lt;&amp;lt; Normal Mixtures(
			Y(:height, :weight),
			{Mixtures Tolerance(0.00000001), Mixtures MaxIter(300), Mixtures N Starts(30),
			Outlier Cluster(0), Diagonal Variance(0), Number of Clusters(2), Go()}
		)
	)
);

cols = Associative Array(dt &amp;lt;&amp;lt; Get Column Names("String"));
nm &amp;lt;&amp;lt; Save Clusters;
cluster_col = Associative Array(dt &amp;lt;&amp;lt; Get Column Names("String"));
cluster_col &amp;lt;&amp;lt; Remove(cols);
cluster_col = (cluster_col &amp;lt;&amp;lt; get keys)[1];

vlb &amp;lt;&amp;lt; Append(
	sm = dt &amp;lt;&amp;lt; Scatterplot Matrix(
		Y(:height, :weight),
		Group(:Cluster),
		Matrix Format("Lower Triangular"),
		Shaded Ellipses(1),
		Ellipses Coverage(0.4),
		Group By(Eval(cluster_col))
	);
);

biv = dt &amp;lt;&amp;lt; Bivariate(Y(:weight), X(:height), By(:Cluster), Invisible);
biv &amp;lt;&amp;lt; Density Ellipse(0.4, {Select Points Inside});

new_col = dt &amp;lt;&amp;lt; New Column("Ellipse", Numeric, Nominal, Formula(
	If(Selected() &amp;amp; :Cluster == 1,
		1
	, Selected() &amp;amp; :Cluster == 2,
		-1
	,
		0
	)
));
dt &amp;lt;&amp;lt; run formulas;
new_col &amp;lt;&amp;lt; Delete Formula;
dt &amp;lt;&amp;lt; clear select;

// Just for visualization purposes
gb = dt &amp;lt;&amp;lt; Graph Builder(
	Size(653, 491),
	Show Control Panel(0),
	Variables(
		X(:height),
		Y(:weight),
		Overlay(:Cluster, Overlay Encoding("Style")),
		Color(:Ellipse)
	),
	Elements(Points(X, Y, Legend(3)))
);

For(i = 1, i &amp;lt;= 2, i++,
	ls = Report(biv[i])[FrameBox(1)] &amp;lt;&amp;lt; Find Seg(LineSeg(1));
	xs = ls &amp;lt;&amp;lt; Get X Values;
	ys = ls &amp;lt;&amp;lt; Get y Values;
	Eval(EvalExpr(
		Report(gb)[FrameBox(1)] &amp;lt;&amp;lt; Add Graphics Script(
			Line(Expr(xs), Expr(ys));
		)		
	));
);
//biv &amp;lt;&amp;lt; close window;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_4-1730822895958.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69840i94368981E7829274/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_4-1730822895958.png" alt="jthi_4-1730822895958.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_5-1730822903982.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69841i7D9930D190FF2CAA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_5-1730822903982.png" alt="jthi_5-1730822903982.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 16:08:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-record-the-classification-of-data-points-within-ellipses/m-p/809680#M99075</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-05T16:08:31Z</dc:date>
    </item>
  </channel>
</rss>

