Subscribe Bookmark RSS Feed

CDF function in JSL

jmper

Community Trekker

Joined:

Apr 7, 2014

Is there a cdf function in JSL that can return the percentile of a value x with a distribution defined by an array or a column in data table?

I only found functions that return the percentiles for special distribution functions (normal, beta, gamma...), but I need t find out in an array of measured data what is the percentile of one measured value.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

There is a function CDF() that generates a list with two matrices that can be used for finding the approximate percentiles. The distribution platform can also be used (interactively or via JSL).

The results will differ between the three methods below, especially for extreme percentiles and small number of data:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

Y = :Weight << get values;

{Quant, CumProb} = CDF( Y );

P = [0.1, 0.5, 0.9]; // Example of percentile levels

// Find approximate values of the P percentiles by "matching"

P1 = Quant[Loc Sorted( CumProb, P )];

// Find approximate P percentiles by interpolating the CDF

// For small data sets the results depends much on the choice of smoothing term lambda (here 1)

P2 = Spline Eval( P, Spline Coef( CumProb, Quant, 1 ) );

// Find approximate percentiles using Distribution platform

dist = dt << Distribution(

  Continuous Distribution(

  Column( :weight ),

  Fit Distribution( Smooth Curve( Quantiles( P[1], P[3], P[2] ) ) )

  )

);

P3 =Report( dist )[Number Col Box("Quantile")]<<get as matrix;

Show( P1, P2, P3 );

2 REPLIES
Solution

There is a function CDF() that generates a list with two matrices that can be used for finding the approximate percentiles. The distribution platform can also be used (interactively or via JSL).

The results will differ between the three methods below, especially for extreme percentiles and small number of data:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

Y = :Weight << get values;

{Quant, CumProb} = CDF( Y );

P = [0.1, 0.5, 0.9]; // Example of percentile levels

// Find approximate values of the P percentiles by "matching"

P1 = Quant[Loc Sorted( CumProb, P )];

// Find approximate P percentiles by interpolating the CDF

// For small data sets the results depends much on the choice of smoothing term lambda (here 1)

P2 = Spline Eval( P, Spline Coef( CumProb, Quant, 1 ) );

// Find approximate percentiles using Distribution platform

dist = dt << Distribution(

  Continuous Distribution(

  Column( :weight ),

  Fit Distribution( Smooth Curve( Quantiles( P[1], P[3], P[2] ) ) )

  )

);

P3 =Report( dist )[Number Col Box("Quantile")]<<get as matrix;

Show( P1, P2, P3 );

jmper

Community Trekker

Joined:

Apr 7, 2014

My question was how to get CumProb from Quant and your examples are how to get Quant from CumProb, but the sample principle applies. Thanks a lot!