cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-528892%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EWhat%20is%20the%20function%20to%20calculate%20the%20column%20percentile%20of%20a%20specific%20number%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-528892%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EAs%20an%20example%2C%20I%20have%20a%20data%20table%20with%20column%20%22X%22%20with%20values%20%221%2C2%2C3%2C....13%2C%2014%2C%2015%22.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20understand%20it%20is%20easy%20to%20calculate%20the%2020%25%20quantile%20using%20function%3A%20Col%20Quantile(%3AX%2C%200.2)%20%3D%203.2.%3C%2FP%3E%3CP%3EIs%20there%20a%20function%20to%20calculate%20the%20percentile%20of%20a%20number%20in%20this%20column%20%22X%22%2C%20for%20example%203%3F%3C%2FP%3E%3CP%3EIf%20so%2C%20is%20there%20a%20way%20to%20calculate%20it%20in%20the%20%22Table%20Summary%22%20for%20multiple%20columns%3F%3C%2FP%3E%3CP%3EThank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-528892%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EAnalytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-528942%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20What%20is%20the%20function%20to%20calculate%20the%20column%20percentile%20of%20a%20specific%20number%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-528942%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHere%20is%20the%20entry%20from%20the%20Scripting%20Index%20for%20the%20Normal%20Distribution%20function%20which%20returns%20the%20probability%20for%20a%20given%20value%2C%20with%20a%20given%20mu%20and%20sigma.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22txnelson_0-1659372520553.png%22%20style%3D%22width%3A%20635px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F44445iBB3C06BF15E5A720%2Fimage-dimensions%2F635x560%3Fv%3Dv2%22%20width%3D%22635%22%20height%3D%22560%22%20role%3D%22button%22%20title%3D%22txnelson_0-1659372520553.png%22%20alt%3D%22txnelson_0-1659372520553.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ESo%20if%20I%20am%20understanding%20your%20question%20correctly%2C%20you%20would%20specify%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ep%3Dnormal%20distribution(3%2C%20col%20mean(%3Ax)%2C%20col%20stddev(%3Ax)%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-529088%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20What%20is%20the%20function%20to%20calculate%20the%20column%20percentile%20of%20a%20specific%20number%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-529088%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EHi%2C%20txnelson%3A%3C%2FP%3E%3CP%3EThanks%20for%20your%20reply!%3C%2FP%3E%3CP%3EI%20am%20not%20a%20statistician%2C%20but%20wonder%20if%20there%20is%20way%20to%20calculate%20it%20for%20data%20which%20is%20not%20limited%20to%20normal%20distribution.%3C%2FP%3E%3CP%3EWhat%20I%20was%20really%20looking%20for%20is%20a%20function%20doing%20the%20reverse%20calculation%20of%20%22Col%20Quantile%20(%3AX%2C%200.2)--%26gt%3B%203.2%22%2C%20meaning%20f(%3AX%2C%203.2)--%26gt%3B%2020%25.%20Or%20mathematically%20N%20rows%20(%20where%20(%3AX%26lt%3B0.32)%20)%20%2F%20N%20rows(%3AX).%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-529101%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20What%20is%20the%20function%20to%20calculate%20the%20column%20percentile%20of%20a%20specific%20number%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-529101%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMaybe%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ECol%20Rank(%3AX)%20%2F%20Col%20Number(%3AX)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eor%20maybe%20you%20could%20use%20CDF()%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-529132%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%3A%20What%20is%20the%20function%20to%20calculate%20the%20column%20percentile%20of%20a%20specific%20number%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-529132%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EExpanding%20on%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F14366%22%20target%3D%22_blank%22%3E%40jthi%3C%2FA%3E%26nbsp%3Bidea%2C%20here%20is%20a%20function%20that%20works.%26nbsp%3B%20Remember%2C%20the%20value%20returned%20is%20partially%20made%20up%20from%20a%20linear%20interpolation%20between%20the%20adjacent%20cumulative%20probabilities.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0Adt%20%3D%20%0A%2F%2F%20Open%20Data%20Table%3A%20big%20class.jmp%0A%2F%2F%20%E2%86%92%20Data%20Table(%20%22big%20class%22%20)%0AOpen(%20%22%24SAMPLE_DATA%2Fbig%20class.jmp%22%20)%3B%0A%0Aquantile%20Distribution%20%3D%20Function(%20%7Bcol%2C%20value%7D%2C%0A%20%7Bdefaultlocal%7D%2C%20%0A%20%7Bquant%2C%20cumprob%7D%20%3D%20CDF(%20Column(%20col%20)%20%26lt%3B%26lt%3B%20get%20values%20)%3B%0A%20result%20%3D%20Interpolate(%20value%2C%20quant%2C%20cumprob%20)%3B%0A%20Return(%20result%20)%3B%0A)%3B%0A%0Ares%20%3D%20quantile%20distribution(%20%22height%22%2C%2053%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar

What is the function to calculate the column percentile of a specific number?

Hi,

As an example, I have a data table with column "X" with values "1,2,3,....13, 14, 15". 

I understand it is easy to calculate the 20% quantile using function: Col Quantile(:X, 0.2) = 3.2.

Is there a function to calculate the percentile of a number in this column "X", for example 3?

If so, is there a way to calculate it in the "Table Summary" for multiple columns?

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: What is the function to calculate the column percentile of a specific number?

Expanding on @jthi idea, here is a function that works.  Remember, the value returned is partially made up from a linear interpolation between the adjacent cumulative probabilities.

Names Default To Here( 1 );
dt = 
// Open Data Table: big class.jmp
// → Data Table( "big class" )
Open( "$SAMPLE_DATA/big class.jmp" );

quantile Distribution = Function( {col, value},
	{defaultlocal}, 
	{quant, cumprob} = CDF( Column( col ) << get values );
	result = Interpolate( value, quant, cumprob );
	Return( result );
);

res = quantile distribution( "height", 53 );
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: What is the function to calculate the column percentile of a specific number?

Here is the entry from the Scripting Index for the Normal Distribution function which returns the probability for a given value, with a given mu and sigma.

txnelson_0-1659372520553.png

So if I am understanding your question correctly, you would specify

p=normal distribution(3, col mean(:x), col stddev(:x) );
Jim

Re: What is the function to calculate the column percentile of a specific number?

Hi, txnelson:

Thanks for your reply!

I am not a statistician, but wonder if there is way to calculate it for data which is not limited to normal distribution.

What I was really looking for is a function doing the reverse calculation of "Col Quantile (:X, 0.2)--> 3.2", meaning f(:X, 3.2)--> 20%. Or mathematically N rows ( where (:X<0.32) ) / N rows(:X).     

jthi
Super User

Re: What is the function to calculate the column percentile of a specific number?

Maybe

Col Rank(:X) / Col Number(:X)

or maybe you could use CDF()

-Jarmo
txnelson
Super User

Re: What is the function to calculate the column percentile of a specific number?

Expanding on @jthi idea, here is a function that works.  Remember, the value returned is partially made up from a linear interpolation between the adjacent cumulative probabilities.

Names Default To Here( 1 );
dt = 
// Open Data Table: big class.jmp
// → Data Table( "big class" )
Open( "$SAMPLE_DATA/big class.jmp" );

quantile Distribution = Function( {col, value},
	{defaultlocal}, 
	{quant, cumprob} = CDF( Column( col ) << get values );
	result = Interpolate( value, quant, cumprob );
	Return( result );
);

res = quantile distribution( "height", 53 );
Jim

Recommended Articles