cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Victor60
Level II

Adjusting Time Stamp For Ten Experimental Replicates

Our data has ten replicates (repeats, to be more accurate).  The desired data lies between vehicle speeds of 35 and 70 mph.  For each of the ten replicates, a column labeled "time" exists, and that time indication varies a little, due to experimental procedure variation.

 

I would like to create a calculated column, using JMP commands, not scripts, for "adjusted time."

 

In this column, the value would be zeroed out by subtracting from each time value the first time indicated at the first speed of 35 mph.  For the ten replicates, that column would have to somehow inspect the replicate column, and on the first occasion of a new replicate, change the adjusted time for the 35 mph value time data of that replicate.  In this way, each "adjusted time" column would start at zero, and end at 70 mph.

 

Any ideas how to automate this task?  Thanks in advance.

1 REPLY 1
jthi
Super User

Re: Adjusting Time Stamp For Ten Experimental Replicates

There could be easier was to do the formula depending on if the:

  1. Data is sorted
  2. If 35mph appears only once per repeat
  3. If 35mph has always smallest Time value

Because that information was not given or I did understand something incorrectly I went with a bit more complicated formula:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(12),
	Compress File When Saved(1),
	New Column("Repeat",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4])
	),
	New Column("Speed",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([35, 35, 70, 35, 40, 70, 35, 36, 70, 60, 35, 36])
	),
	New Column("Time",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 2, 3, 1.1, 2, 3, 1.2, 2, 3, 1, 2, 3])
	)
);


dt << New Column("Adjusted Time",
	Numeric,
	"Continuous",
	Formula(
		If(Row() == 1,
			//Find rows with speed of 35
			speedRows = Loc(:Speed << get as matrix, 35);
			//get repeats for 35 rows
			repeats = :Repeat[SpeedRows];
		);
		//time for first 35mph for current rows repeat
		curTime = :Time[Loc(repeats, :Repeat)[1]]; //adjusted time	
		:Time - curTime;
	)
);

jthi_0-1626098395928.png

 

-Jarmo