cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
KaisersHuman
Level I

Forward Lag

I am attempting to write a formula that works off a forward lag function. I have multiple data sets with values that are a function of time (1200Hz). I want to alter these columns so that the max value is equal to 0.5 seconds, so that when I graph the data, I can do so where the max values overlap. I was able to write this formula so that it works above the column max, but cannot get it to work in a reverse lag function. 

 

If(
:A == Col Maximum( :A ), 0.5,
Lag( Col Maximum( :A ), 1 ), Lag( :B, 1 ) + 1 / 1200,
Lag( Col Maximum( :A ), -1 ), Lag( :B, -1 ) - 1 / 1200
)

 

As you can see from the preview, it works after the 

 

Picture1.png

3 REPLIES 3
txnelson
Super User

Re: Forward Lag

I believe this is what you need

If(
	:A == Col Maximum( :A ), 0.5,
	Lag( :A, 1 ) == Col Maximum( :A ), Lag( :B, 1 ) + 1 / 1200,
	Lag( :A, -1 ) == Col Maximum( :A ), Lag( :B, -1 ) - 1 / 1200
)

BTW.....it is much handier for the responder to have your sample data not just displayed as a picture, but also to have it in a machine readable form.  Attaching your data table would be nice.

Jim
KaisersHuman
Level I

Re: Forward Lag

Hi, thank you for the reply! 

 

That didn't quite obtain what I was looking for. Thank you for the note about attaching data, as this is my first question - I wasn't sure the proper protocol. I have attached below.

 

As you'll see Column B's output formula creates the desired product above 0.5, counting 1/1200 sec up from there, but I need it to count backward by 1/1200 of a second from 0.5, which is where I am struggling since it is dependent on the columnmax from column A

txnelson
Super User

Re: Forward Lag

Your IF() statement is being interpreted as you have written it.  

However, 

Lag( Col Maximum( :A ), 1 )

returns the value of 2693.162203 which will be interpreted a TRUE, so then 

Lag( :B, 1 ) + 1 / 1200

Will be executed.  The third comparison will never be executed since the second comparison will always return a positive value.

What are you expecting 

Lag( Col Maximum( :A ), 1 )

to return?

Jim

Recommended Articles