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!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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