cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • See how to use the JMP Marketplace – Free tools to expand JMP capabilities. Register. July 10, 2 pm US Eastern Time.

JMP Wish List

We want to hear your ideas for improving JMP. Share them here.
Choose Language Hide Translation Bar
0 Kudos

Col Moving Quantile() function

I would like a built-in function similar to Col Moving Average() that computes a moving (rolling) quantile of a a column. You could call it Col Moving Quantile() and/or Col Moving Median().

I wrote a user function (attached) which works well enough for small tables, but it uses a very inefficient approach. I know for absolutely sure that there are much more efficient ways to implement this function that don't involve brute force recalculation at each rolling step. Those approaches are beyond my coding ability.

Add Custom Functions(
	New Custom Function(
		"x",
		"Col Moving Quantile",
		Function( {col, p, before, after, dt = Current Data Table()},
			{coldata = Column( dt, col ) << Get As Matrix, from = Max( Row() - before, 1 ), to, to = Min( Row() + after, N Rows( dt ) )},
			Quantile( p, coldata[Index( from, to )] )
		)
	)
	
	// === Documentation ===
	<<Formula Category( "Statistical" ) //
	<<Scripting Index Category( "Statistical+" ) //
	<<Description( "Returns the moving (rolling) quantile of the specified column." ) //					
	<<Prototype( "x:Col Moving Quantile( ColName( string ), p, before, after, <Table reference> )" ) //		
	<<Parameter( "String", "ColName( string )" ) //
	<<Parameter( "Number", "p" ) //
	<<Parameter( "Number", "Before" ) //
	<<Parameter( "Number", "After" ) //
	<<Parameter( "Name", "Table" )
);

 
1 Comment
Ryan_Gilmore
Community Manager
Status changed to: Archived
We are archiving this request. If this is still important please comment with additional details and we will reopen. Thank you!