cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar

Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

I am plotting CD vs. Depth plot, for total 8 sets in the example (A-a, A-b, B-a, B-b....).For each Test A~D, there are 2 different 'Location' a and b. 

I'd like to pick 2 set specifically and create a delta plot; for example, If I select A-a and B-a, CD values are subtracted at each depth and CD vs. Depth plot should be generated.

 

Is this something I can do at JMP? I was trying to do this in excel using xlookup function, but since the amount of data is huge (30000+ rows) it is just too slow. I am not sure if this something I can do at JMP.

 

Example data set

EdgeMarmoset719_1-1739301136957.png

 

Example CD vs. Depth plot;

EdgeMarmoset719_2-1739301617796.png

 

 

6 REPLIES 6
jthi
Super User

Re: Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

With scripting this can definitely be done and maybe also without scripting at least as a workflow. Can you provide example dataset and can you only pick two pairs at the same time? Also is the location always same for selected tests?

-Jarmo

Re: Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

Sure, here is the example data file.

 

I am looking to get the delta value between two pair, so yes I'd always pick 2 for comparison.

 

Location may not be the same, in the real data set I have some samples that have more locations. I also need to compare sample to sample as well as location to location. For instance, sample A-a to sample C-b

 

Here is 

jthi
Super User

Re: Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

Is it OK if new data table is created after user selections? My basic idea would be with scripting:

  1. Add ordering column to your data
  2. Create UI in which user can pick from list box which combinations to compare
  3. User presses OK and new table will be created with data for those two combinations
  4. Difference will be calculated
  5. Visual the data

Other option that comes to my mind is to split the data and pre-calculate all the differences into columns. Then you could use Column Switcher in graph builder to change which to compare.

-Jarmo

Re: Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

I wanted to see if I can quickly change conditions for comparison. It seems that is not as straightforward.

 

Calculating all the differences would not work since there are so many data set I would think.

 

Thanks for the help, let me think a bit more.

jthi
Super User

Re: Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

Only scripting options come to my mind (outside of that splitting). I consider JMP tables to be more like database tables than spreadsheet, so the calculations are (usually) done on row level and as aggregations. If the test count is always the same for each of the "pairs" this can be maybe done with a few formula columns and global data filter to make picking options easier.

-Jarmo
jthi
Super User

Re: Creating delta values plot between two subsets; want to select 2 'tests' to compare among multiple test values

With scripting you can create things like this (this is missing some sanity checks)

 

Names Default To Here(1);

dt = Current Data Table();
dt << New Column("Group", Character, Nominal, Formula(
	"Test: " || :Test || " Location: " || :Location
));

Summarize(dt, groups = By(:Group));


dt_temp = New Table("TEMPTABLE",
	Add Rows(5), // same as your group size
	Compress File When Saved(1),
	New Column("Depth",
		Numeric,
		"Continuous",
		Values([0, 20, 40, 60, 80])
	),
	New Column("CD First",
		Numeric,
		"Continuous"
	),
	New Column("CD Second",
		Numeric,
		"Continuous"
	),
	New Column("CD diff",
		Numeric,
		"Continuous"
	),
	Invisible
);

update_expr = Expr(
	Try(
		first_group = (lb_first << get selected)[1];
		second_group = (lb_second << get selected)[1];

		first_cd = dt[dt << Get Rows Where(:Group == first_group), "CD (nm)"];
		second_cd = dt[dt << Get Rows Where(:Group == second_group), "CD (nm)"];
		dt_temp[0, "CD First"] = first_cd;
		dt_temp[0, "CD Second"] = second_cd;
		dt_temp[0, "CD Diff"] = Abs(second_cd - first_cd);
	,
		dt_temp[0, "CD First"] = [., . ,., ., .];
		dt_temp[0, "CD Second"] = [., . ,., ., .];
		dt_temp[0, "CD Diff"] = [., . ,., ., .];
	);
);

nw = New Window("Demo",
	H List Box(
		Panel Box("Pick First Group",
			lb_first = List Box(groups)
		),
		Panel Box("Pick Second Group",
			lb_second = List Box(groups)
		),
		Data Table Box(dt_temp),
		gb = dt_temp << Graph Builder(
			Size(525, 454),
			Show Control Panel(0),
			Variables(X(:CD diff), Y(:Depth)),
			Elements(Points(X, Y, Legend(11)), Line(X, Y, Legend(13)))
		),
		Panel Box("Actions",
			Lineup Box(N Col(1),
				Button Box("Cancel")
			)
		)
	)
);

lb_first << Set Max Selected(1);
lb_second << Set Max Selected(1);

lb_first << Set Script(update_expr);
lb_second << Set Script(update_expr);

Eval(EvalExpr(
	nw << On Close(
		Close(dt_temp, no save);
	)
));

 

jthi_1-1739472136044.png

I think you could also duplicate your table so you can do a self-join with "duplicated" columns, join it to the original table by depth, remove self-joins, create grouping selector, formula for differences and create a plot

jthi_2-1739472611700.png

And this is easy to automate in JMP.

jthi_5-1739472774400.png

 

-Jarmo

Recommended Articles