How can I make cumulative probability plot like the one below? Appreciate your help.
Below are three different options
There is also a nice way via Graph Builder:
First select the grouping parameter
then use the (right click) context menu/Distributional/ cumulative probability function to generate the ColRank/ColNumber equation and put it on the y axis (the value itself on the x axis).
that's it:
Open( "$SAMPLE_DATA/Big Class.jmp" ); Data Table( "Big Class" ) << Graph Builder( Size( 534, 464 ), Show Control Panel( 0 ), Variables( X( :height ), Y( Transform Column( "Cumulative Prob...ty[height][sex]", Formula( Col Rank( :height, :sex ) / (Col Number( :height, :sex ) + 1) ) ) ), Overlay( :sex ) ), Elements( Points( X, Y, Legend( 11 ) ), Smoother( X, Y, Legend( 12 ) ) ) );
As I'm using this quite often, I've implemented a simple script in custom menue (view --> customize --> menues and toolbars),
running it with a table open it makes the CDF Plot quite easily.
Oneway( all graphs( 0 ), CDF Plot( 1 ) );
Holger, thanks for the instruction, that is a new analysis skill which I am completely unaware. further question, if I want to do Left side Y-axis with standard deviation, right side Y-axis with cumulative probability, how to add a right Y in graph builder?
is this what you mean?
Open( "$SAMPLE_DATA/Big Class.jmp" ); Graph Builder( Size( 688, 430 ), Show Control Panel( 0 ), Graph Spacing( 5 ), Variables( X( Transform Column( "Normal Quantile [sigma]", Formula( Normal Quantile( Col Rank( :height, :sex ) / (Col Number( :height, :sex ) + 1), 0, 1 ) ) ) ), X( Transform Column( "Cumulative Prob [1=100%]", Formula( Col Rank( :height, :sex ) / (Col Number( :height, :sex ) + 1) ) ) ), X( :sex ), Y( :height ), Overlay( :sex ) ), Elements( Position( 1, 1 ), Points( X, Y, Legend( 17 ) ), Smoother( X, Y, Legend( 18 ) ) ), Elements( Position( 2, 1 ), Points( X, Y, Legend( 11 ) ), Smoother( X, Y, Legend( 12 ) ) ), Elements( Position( 3, 1 ), Box Plot( X, Y, Legend( 16 ) ) ) );
I really like Georg's approach to add a shortcut to the main menu.
My new universal plot button (best: with normal prob. scale
On the other hand, the GraphBuilder version with the individual data points provides more interactivity.
How would you adjust such graphbuilder code such that it can be used dynamically for any table like Georg's one:The user should have the possibility to dynamically choose the variable to plot and the grouping variable.
For X, Y and Overlay, I can just use the Application Builder - but how to implement it for the Transform Column inline Formula?
.
@r30363 wrote: if I want to do Left side Y-axis with standard deviation, right side Y-axis with cumulative probability, how to add a right Y in graph builder?
if I want to do Left side Y-axis with standard deviation, right side Y-axis with cumulative probability, how to add a right Y in graph builder?
The left and right Y axis are not linked. So, after changing one of them one has to click on "reset Normal Quantile Scale" - or is there a Plot Scale Change Handler in Jmp? *)
Names Default To Here( 1 ); dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); New Column( "normal Quantiles" ); Graph Builder( Transform Column( "Cumulative Probability", Formula( Col Rank( :height, :sex ) / (Col Number( :height, :sex ) + 1) ) ), Show Control Panel( 0 ), Variables( X( :height ), Y( :normalQuantiles ), Y( :Cumulative Probability, Position( 1 ), Side( "Right" ) ), Overlay( :sex ) ), Elements( Points( X, Y( 2 ) ), Smoother( X, Y( 2 ) ) ), SendToReport( Dispatch( {}, "Cumulative Probability", ScaleBox, {Scale( "Normal Probability" ), Format( "Best", 12 ), Min( 0.01 ), Max( 0.99 ), Inc( 0.1 ), Minor Ticks( 1 )} ) ) ); New Namespace( "reset" ); reset:NormalQuantileScale = Function( {}, myScript = (Current Report() << XPath( "//AxisBox" ))[3] << get script(); myMin = Normal Quantile( myScript["min"] ); myMax = Normal Quantile( myScript["max"] ); (Current Report() << XPath( "//AxisBox" ))[2] << Min( myMin ) << Max( myMax ) << inc( 0.5 ); ); Current Report()[List Box( 2 )] << append( Button Box( "reset Normal Quantile Scale", reset:NormalQuantileScale() ) ); reset:NormalQuantileScale()
asking for a friend/colleague:
With the current version of Jmp, is there an easy way to generate a split grouped probability plot?
I can generate such a plot via Graph Builder, but I have to implement a hand-made functionality which re-generates the Transform column once the user selects different columns or different entries in the Local Data Filter - and it's extremely slow!
Accepting that the graph won't be as interactive as what a Jmp user is used from Graph Builder, one can use Live Distribution/Compare Groups - with a By variable. It can be much faster than Graph Builder - but there are cases where you have to wait literally "hours" till the plot shows up [see below].The original report doesn't look like expected - but with several commands to the report (*) the plot gets almost as nice as in Minitab.
The benefit compared to the Graph Builder approach: more Distributions/scales to select from
The disadvantages compared to Minitab:- not stable- very slow
Open( "$SAMPLE_DATA/Cars.jmp" );Graph Builder( Transform Column( "CDF", Formula( Col Rank( :Wt, :Doors, :Year ) / (Col Number( :Wt, :Doors, :Year ) + 1) ) ), Variables( X( :Wt ), Y( :CDF ), Group Y( :Year ), Overlay( :Doors ) ), Elements( Line Of Fit( X, Y, ), Points( X, Y, Legend( 14 ) ) ) ); myld = Life Distribution( Perspective( Compare Groups ), Y( :Wt ), Grouping( :Doors ), Confidence Interval Method( Wald ), Select Distribution( Distribution, Normal ), Select Scale( Normal ), << Show Statistics( 0 ), By( :Year) ); (myld << XPath("(//OutlineBox[text()='Statistics'])")) << Visibility( "Collapse" ); (myld << xpath("//OutlineBox[text()='Individual Group']")) << Visibility( "Collapse" ); ((myld << xpath ("//RadioBox")) << parent) << Visibility( "Collapse" ); (myld << xpath("//OutlineBox[text()='Compare Distribution']//IfBox"))<< Visibility( "Collapse" ); //(myld << xpath("//OutlineBox[text()='Compare Distribution']")) <<Set Title( "" ); // current Report()[ListBox(1)] << Set Horizontal( 1 ); (myld << xpath("//OutlineBox")) <<Set Title( "" ); myABS = (myld << xpath ("//OutlineBox//AxisBox")); Transform Each({ABList},myABs[1::Nitems(myABs)-1],ABList[2]) << Label Row( {Automatic Tick Marks( 0 ), Show Major Ticks( 0 ), Show Minor Ticks( 0 ), Show Major Labels( 0 )} ); myTEBs = (myld << xpath ("//OutlineBox//TextEditBox")); Transform Each({TEBList},myTEBs[1::Nitems(myTEBs)-1],TEBList[2])<<Set Text( "" ) ;
With a little work you can almost reproduce what you get from the Fit Y by X CDFs -- you just have to add a line and switch its connection to "Step" and Summary Statistic to "Max". However unlike a real CDF you don't get the vertical lines at the endpoints going to 0 and 1.0. I'm hoping this will make it into Graph Builder as a first-class citizen someday.
With a little work?how?
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#M6200
Open( "$SAMPLE_DATA/Airline Delays.jmp" ); Graph Builder( Variables( X( :Arrival Delay ), Wrap( :Month ), Overlay( :Airline ) ), Elements( Line( X, Summary Statistic( "Cumulative Percent" ) ) ));
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" ) ) ) );