cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
cc0317
Level I

Plotting Multiple Groups with the same Initial Conditions

Hello, 

I am trying to analyze the trends of some data where I conditioned several groups of product over time, but they have the same initial conditions. It is possible to have one category that can be applied to multiple other categories in the same column. Or, in other words, I am trying to connect each of the lines below to the Initial Conditions group.

4 REPLIES 4
jthi
Super User

Re: Plotting Multiple Groups with the same Initial Conditions

What does your data look like?

-Jarmo
txnelson
Super User

Re: Plotting Multiple Groups with the same Initial Conditions

For graphing purposes, I would have the tendency to replicate my control group data for each of the groupings you want to display it with.  

Jim
hogi
Level XII

Re: Plotting Multiple Groups with the same Initial Conditions

Agree with @txnelson , in addition, to get the line dispayed, it's enough to add a single data point per group to the data set - with the median (or mean) value.

On the other hand, it's surprising that this has to be done.
For each of the groups, there is data available for several time steps, so talso 0h data should be available - not a separate "0h data set".

- if the 0h data is taken separate from the runs of the groups, how to guarantee that the 0h data for the groups matches that of the 0h data set?
- If the groups are subsets of the 0h data set, how to guarantee that they are indistinguishable? worst case: group 30/35 corresponds to the lower 20% of the sample - condition 50/50 corresponds to the upper 20%.

MathStatChem
Level VI

Re: Plotting Multiple Groups with the same Initial Conditions

 Pretty common data prep step for stability data at multiple storage conditions.  As described below, the general procedure to do this is:

  1. Summarize the storage conditions into a separate table.
  2. Past those conditions at the end of the original table, and set the time point for those rows to be the initial time point.
  3. Calculate the average response(s) at the starting time point, and use that value for all the pasted rows above.  
  4. Delete or Hide/Exclude the original initial timepoints from the data table.

I just happened to recently finish a script to help automate this (provided with no guarantee or warranty).  

 

Names Default To Here( 1 );
// utility to replicate stability condition labels and variables at time Zero for each stabilty condition

dt = Current Data Table();
timelistdisplay = 0;
nw = New Window( "Replicate Initial Time Point Results Across Conditions",
	hb = H List Box(
		pb_1 = Panel Box( "Select Columns", clb_1 = Col List Box( all ) ),
		pb_2 = Panel Box( "Case Column into Role", 

			lub_variables = Lineup Box( N Col( 2 ),
				Button Box( "Time Column",
					Try(
						clb_time << append( clb_1 << get selected );
						c_time_name = (clb_time << get items)[1];
					);
					c_time = Column( dt, c_time_name );
					time_list = Associative Array( As List( (c_time << get values) ) ) << get keys;
					For Each( {s, i}, time_list, time_list[i] = Char( s ) );
					If( !timelistdisplay,
						pb_2 << Append(
							hb_timelist = H List Box( Text Box( "Initial Time Point to Replicate" ), combox = Combo Box( {} ) )
						);
						timelistdisplay = 1;
					);
					combox << set items( time_list );
				),
				clb_time = Col List Box( "numeric", Max Items( 1 ), nlines( 1 ), minItems( 1 ) ),
				Button Box( "Stability Condition Columns", clb_stabcond << append( clb_1 << get selected ) ),
				clb_stabcond = Col List Box( Min Items( 1 ), nLines( 4 ) ),
				Button Box( "Response Columns", clb_response << append( clb_1 << get selected ) ),
				clb_response = Col List Box( minItems( 1 ), nlines( 5 ) ), 
					
			)
		),
		pb_3 = Panel Box( "Actions",
			V List Box(
				Button Box( "OK",
					responsecols = clb_response << get items;
					// check that all boxes are populated and if so, then do actions
					If(
						N Items( clb_time << get items ) & N Items( clb_stabcond << get items ) &
						N Items( clb_response << get items ), 
					// make list of column references for the stability condition columns
						dt << clear select;
						Eval(
							Substitute(
									Expr(
										dt << select where( As Column( dt, c_time_name ) != vvv )
									),
								Expr( vvv ),
									Num( combox << get selected )
							
							)
						);
						
						dt_sub = dt << Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
					
						stab_cond_col_list = {};
						For Each( {s, i}, clb_stabcond << get items, Insert Into( stab_cond_col_list, Column( dt, s ) ) );
						dt_summary = dt_sub << Summary(
							Group( stab_cond_col_list ),
							Freq( "None" ),
							Weight( "None" ),
							Link to original data table( 0 ),
							output table name( "Stability Conditions" )
						);
						dt_summary << delete columns( :N Rows );
						Close( dt_sub, nosave );
						cnew = dt_summary << New Column();
						cnew << set name( c_time_name );
						timezero = Num( combox << get selected );
						cnew << Set Values( J( N Row( dt_summary ), 1, timezero ) );
						dt << clear select;
						
						// get the results for time zero
						Eval(
							Substitute(
									Expr(
										dt << select where( As Column( dt, c_time_name ) == vvv )
									),
								Expr( vvv ),
									Num( combox << get selected )
							
							)
						);
						// add those to the summary table of conditions
						For Each( {rc}, responsecols,
							val = Mean( Column( dt, rc )[dt << get selected rows] );
							c = dt_summary << New Column( rc );
							c << set values( J( N Rows( dt_summary ), 1, val ) );
						);
						
						// hide and exclude the initial values results in the first table
						dt << hide and exclude;
						dt << clear select;
						
						// now concatenate the summary table onto the original table.
						
						dt << Concatenate( dt_summary, Append to first table );
						
						close(dt_summary, nosave);
						nw<<close window;
						
					)
					
					;
				),
				Button Box( "Remove", 
						// check time variable
					temp = clb_time << get selected;
					If( N Items( temp ),
						clb_time << remove selected;
						timelistdisplay = 0;
						hb_timelist << delete;
					);
					// stability condition
					clb_stabcond << remove selected;
					clb_response << remove selected;
						
				),
				Button Box( "Cancel", nw << close window )
			)
		)		

	)
);

Example: (also attached)

MathStatChem_1-1731704006225.png

 

Dialog:

MathStatChem_2-1731704075831.png

 

Result:

MathStatChem_3-1731704134924.png