cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
jthi
Super User

Using Where() to filter down analysis creates new linked private data table

Usually I don't care when JMP (JSL) does something I don't expect it to do as most of the time get it working and it is only thing I care about... but today I came up with something "interesting". If you use Where() to filter down your analysis, you will end up with private data table which is linked to your data table (with fairly weird name, in this case "Big Class, where -sex == -F-")

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

nw = New Window("",
	V List Box(
		gb1 = dt << Graph Builder(
			Size(534, 456),
			Show Control Panel(0),
			Variables(X(:height), Y(:weight), Overlay(:sex)),
			Elements(Points(X, Y, Legend(3)))
		),
		gb2 = dt << Graph Builder(
			Size(534, 456),
			Show Control Panel(0),
			Variables(X(:height), Y(:weight), Overlay(:sex)),
			Elements(Points(X, Y, Legend(3))),
			Where(:sex == "F")
		)
	)
);

Show(gb1 << Get Data Table);
Show(gb2 << Get Data Table);
/*
dt_private = gb2 << Get Data Table;
dt_private << New Data View;
*/

So I do have few questions regarding this behavior:

  • Does this happen always when I use Where() like this to filter down analysis (not just in Graph Builder)?
  • Is this documented somewhere?
  • Are there more interactions like this in JMP where you create some hidden things which you then might come across like this (for me this caused issues with one of my functions because I used << Get Data Table to get the reference for the data table but got wrong one, easy fix was to add table reference to the function as parameter
  • Should I even do filtering like this?

 

Edit:

Adding few help pages which are at least partially related to this

-Jarmo
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Using Where() to filter down analysis creates new linked private data table

Platforms have common handling for Where() and By(), both of which create subset tables to implement the functionality.  I am not sure whether there is documentation to this level of detail on implementation.

 

The subset can provide a useful distinction compared to row-state manipulation via filters.  This example shows that when you fit a model to subsets, JMP will avoid applying that model to the rows that are not in the subset.  If you do the same thing with a filter, the model is applied to all rows.

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line( {Line Color( {212, 73, 88} )} ), By(:sex) );
biv[1] << (Curve[1] << Save Predicteds);
biv2 = dt << Bivariate(
	Y( :weight ),
	X( :height ),
	Fit Line( {Line Color( {212, 73, 88} )} ),
	Local Data Filter(
		Auto clear( 1 ),
		Grouped by AND( 1 ),
		Show Histograms and Bars( 0 ),
		Add Filter( columns( :sex ), Where( :sex == "F" ) )
	)
);
biv2 << (Curve[1] << Save Predicteds);

Whether you want to use this type of subset may depend on the specifics of the analysis that you are doing.

 

-Dan

View solution in original post

1 REPLY 1

Re: Using Where() to filter down analysis creates new linked private data table

Platforms have common handling for Where() and By(), both of which create subset tables to implement the functionality.  I am not sure whether there is documentation to this level of detail on implementation.

 

The subset can provide a useful distinction compared to row-state manipulation via filters.  This example shows that when you fit a model to subsets, JMP will avoid applying that model to the rows that are not in the subset.  If you do the same thing with a filter, the model is applied to all rows.

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line( {Line Color( {212, 73, 88} )} ), By(:sex) );
biv[1] << (Curve[1] << Save Predicteds);
biv2 = dt << Bivariate(
	Y( :weight ),
	X( :height ),
	Fit Line( {Line Color( {212, 73, 88} )} ),
	Local Data Filter(
		Auto clear( 1 ),
		Grouped by AND( 1 ),
		Show Histograms and Bars( 0 ),
		Add Filter( columns( :sex ), Where( :sex == "F" ) )
	)
);
biv2 << (Curve[1] << Save Predicteds);

Whether you want to use this type of subset may depend on the specifics of the analysis that you are doing.

 

-Dan