cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Due to inclement weather, JMP support response times may be slower than usual during the week of January 26.
    To submit a request for support, please send email to support@jmp.com.
    We appreciate your patience at this time.
  • Register to see how to import and prepare Excel data on Jan. 30 from 2 to 3 p.m. ET.

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!