cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
r30363
Level II

how to make cumulative probability plots in JMP?

How can I make cumulative probability plot like the one below? Appreciate your help.

r30363_0-1658152068599.png

 

 

36 REPLIES 36
hogi
Level XII

Re: how to make cumulative probability plots in JMP?

The solution comes from @XanGregg - employing a hidden feature of "Line" graph:
https://community.jmp.com/t5/JMP-Wish-List/Add-CDFs-to-Graph-Builder/idc-p/794428/highlight/true#M62... 

Open( "$SAMPLE_DATA/Airline Delays.jmp" );
Graph Builder(
	Variables( X( :Arrival Delay ), Wrap( :Month ), Overlay( :Airline ) ),
	Elements( Line( X,  Summary Statistic( "Cumulative Percent" ) ) ));

 

hogi_0-1725393629467.png


and when you prefer points, it's almost that easy :

Open( "$SAMPLE_DATA/Airline Delays.jmp" );

new column ("one", formula(1)); // enabling the magic for points

Graph Builder(
	Variables( X( :Arrival Delay ), Y( :one_Nr ), Wrap( :Month ), Overlay( :Airline ) ),
	Elements( Points( X, Y, Legend( 3 ), Summary Statistic( "Cumulative Percent" ) ) )
);

hogi_1-1725393873248.png

hogi
Level XII

Re: how to make cumulative probability plots in JMP?

The subtle difference between CDF and Cumulative Probability:

hogi_0-1729186002809.png

 

So, think twice if it's OK to switching the Y scale to Normal Probability!


Life Distribution: Cumulative Probability

hogi_3-1729186245458.png

 

 

Graph Builder (workaround via Cumulative Percent and  1s on the Y axis):

hogi_2-1729186131799.png

 

Open( "$SAMPLE_DATA/Airline Delays.jmp" );

:distance[1] = 10000;

Life Distribution(
	Y( :Distance ),
	<<Set Scale( Normal )
);

Graph Builder(
	Transform Column( "CDF", Formula( 1 ) ),
	Variables( X( :Distance ), Y( :CDF ) ),
	Elements(
		Points( X, Y, Legend( 1 ), Summary Statistic( "Cumulative Percent" ) ),
		Line( X, Y, Legend( 2 ), Summary Statistic( "Cumulative Percent" ) )
	),
		SendToReport(
		Dispatch( {}, "CDF", ScaleBox,
			{Scale( "Normal Probability" )})
));

 

GM-FPP
Level II

Re: how to make cumulative probability plots in JMP?

Hi hogi,

 

Reviving an old thread.  I am trying to understand Graph Builder better.  I can get the fit for the Cumulative Probability that includes all the data:

GMFPP_0-1729273445284.png

 

And I can use the Overlay option below to make it match your graph and show the fit for the different groups:

GMFPP_2-1729274029073.png

 

But I cannot figure out how I can use Graph Builder to combine those graphs (show the fit for all the data and for the different groups in one graph).  Is this possible just using Graph Builder?  I have someone here who seems to get frustrated every time I reference Script, so I want to show how this is done on Graph Builder, if possible, until he gets more accustomed to JMP.

 

Not the same data above, but he wants something like this in the graph area:

GMFPP_3-1729274353026.png

 

Thank you for any assistance,

Grant

GM-FPP
Level II

Re: how to make cumulative probability plots in JMP?

Ignore my message above.  I think I should go home, my brain is done for the week apparently...

hogi
Level XII

Re: how to make cumulative probability plots in JMP?

For a Minitab-like plot - with meaningful fits (!), you have to use LifeDistribution with Perspective: Compare Groups:

hogi_0-1729285038377.png

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Life Distribution(
	Perspective( Compare Groups ),
	Y( :height ),
	Grouping( :sex ),
	Fit Distribution( "Normal" ),
	Select Distribution( Distribution ),
	Select Scale( Normal ),
);
hogi
Level XII

Re: how to make cumulative probability plots in JMP?

To get the overlay  (all data + curves by sex),
you have to switch to Graph Builder,  change the scale on the Y axis to normal probability, calculate the cumulative probability "manually" and play with the variable settings.

You can even activate the fit - and get confidence intervals ...

hogi_7-1729287177634.png

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
	Transform Column(
		"Cumulative Probability[height] by sex",
		Formula( Col Rank( :height, :sex ) / (Col Number( :height, :sex ) + 1) )
	),
	Transform Column(
		"Cumulative Probability[height]",
		Formula( Col Rank( :height ) / (Col Number( :height ) + 1) )
	),
	Variables(
		X( :height ),
		Y( :"Cumulative Probability[height]"n ),
		Y( :"Cumulative Probability[height] by sex"n, Position( 1 ) ),
		Overlay( :sex )
	),
	Elements(
		Points( X, Y( 2 ) ),
		Points( X, Y( 1 ), Overlay( 0 ) ),
		Line Of Fit( X, Y( 2 ) ),
		Line Of Fit( X, Y( 2 ), Overlay( 0 ) )
	),
		SendToReport(
		Dispatch( {}, "Cumulative Probability[height]", ScaleBox,
			{Scale( "Normal Probability" )}))
);

 

hogi
Level XII

Re: how to make cumulative probability plots in JMP?

but the fits don't match ...


The difference:

  • Graph Builder fits a straight line to the cumulative distribution.
  • Life Distribution takes the actual data to determine the parameters of the underlying normal distribution:
    mean and standard deviation
    ...  then it displays the result as cumulative probability - which gives a straight line.

Although both paths result in a straight line, the methods to achieve them differ.
Consequently, the residuals, the fit, and the confidence intervals might differ.


hogi_0-1729289256202.png

Please also note the slight offset between the Y values at the far left and right.

 

[3000]