取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
选择语言 隐藏翻译栏
jmper
Level I

CDF function in JSL

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 个已接受解答

已接受的解答
ms
Super User (Alumni) ms
Super User (Alumni)

Re: CDF function in JSL

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 条回复2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: CDF function in JSL

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
Level I

Re: CDF function in JSL

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!

推荐文章