- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
how to make cumulative probability plots in JMP?
How can I make cumulative probability plot like the one below? Appreciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
Below are three different options
- Use CDF Matrix function JSL Syntax Reference > JSL Functions > Matrix Functions > CDF(Y)
- Use Distribution platform and enable CDF Plot Basic Analysis > Distributions > Options for Continuous Variables > CDF Plot
- Use Fit Y by X and enable CDF Plot Basic Analysis > Oneway Analysis > Additional Examples of the Oneway Platform > Example of a CDF Pl...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
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 ) ) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
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 ) );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
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 ) ) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
Here is a crude example that should provide you a good start on what your idea is
Names Default To Here( 1 );
dt = // Open Data Table: big class.jmp
// → Data Table( "big class" )
Open( "$SAMPLE_DATA/big class.jmp" );
New Window( "Select column",
hlb = H List Box(
clb = Col List Box(
dt << get name,
all,
max selected( 1 ),
Try( vlb << delete );
hlb << append(
vlb = V List Box(
var = (clb << get selected)[1];
Eval(
Substitute(
Expr(
cp = Graph Builder(
Size( 688, 430 ),
Show Control Panel( 0 ),
Graph Spacing( 5 ),
Variables(
X(
Transform Column(
"Normal Quantile [sigma]",
Formula(
Normal Quantile(
Col Rank( __var__, :sex ) / (Col Number( __var__, :sex ) + 1),
0,
1
)
)
)
),
X(
Transform Column(
"Cumulative Prob [1=100%]",
Formula( Col Rank( __var__, :sex ) / (Col Number( __var__, :sex ) + 1) )
)
),
X( :sex ),
Y( __var__ ),
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 ) ) )
)
),
Expr( __var__ ), Parse( var )
)
);
)
);
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
wow, that's very cool
I added a second ColListBox for the grouping variable.
Names Default To Here( 1 );dt=Open( "$SAMPLE_DATA/big class.jmp" );
dt << Clear Column Selection();
updatePlot = Function( {},
If( Length( clb << get selected ) == 0 | Length( clb2 << get selected ) == 0,
Print( "value missing" ),
var = (clb << get selected)[1];
groupByvar = (clb2 << get selected)[1];
Try( vlb << delete );
hlb << append(
vlb = V List Box(
Eval(
Eval Expr(
cp = Graph Builder(
Size( 724, 560 ),
Show Control Panel( 0 ),
Variables(
X( Expr( Name Expr( As Column( var ) ) ) ),
Y(
Transform Column(
"Cumulative Probability[1=100%]",
Formula(
Col Rank( Expr( Name Expr( As Column( var ) ) ), Expr( Name Expr( As Column( groupByvar ) ) ) ) / (
Col Number( Expr( Name Expr( As Column( var ) ) ), Expr( Name Expr( As Column( groupByvar ) ) ) ) + 1)
)
)
),
Overlay( Expr( Name Expr( As Column( groupByvar ) ) ) )
),
Elements( Points( X, Y, Legend( 7 ) ), Smoother( X, Y, Legend( 8 ), Method( "Savitzky-Golay" ), Lambda( 2 ) ) ),
SendToReport(
Dispatch( {}, "Cumulative Probability[1=100%]", ScaleBox, {Scale( "Normal Probability" ), Format( "Best", 12 )} )
)
)
)
)
)
);
)
);
New Window( "grouped Comulative Probability",
hlb = H List Box(
V List Box(
clb = Col List Box( all, <<Set Data Type( "numeric" ), max selected( 1 ), updatePlot() ),
clb2 = Col List Box( all, max selected( 1 ), updatePlot() )
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: how to make cumulative probability plots in JMP?
The approach "delete the plot and replace the plot" makes it really easy to generate reports with complicated interactions
The only disadvantage:
By overwriting the old plot, I also reset all changes that I made to the original plot in the meantime (axis scaling, local data filter, ...)
As an interim solution, I searched for the changes and applied them to the new plot, e.g.:
dt =Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Graph Spacing( 5 ),
Variables( X( :sex ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
// manal change like :
Report( gb )[Axisbox( 2 )] << Min(-100)
//read the oldvalues
mymin=((report(gb)<< xpath( "//AxisBox" ))[2] << getscript())["Min"]
//replace the plot ....
//apply the settings to the new plot
Report( gb )[Axisbox( 1 )] << Min( Eval(myMin ))
Further thinking in this direction:
Is there a possibility to send a message to change the content of the plot?
Seems so ...
gb << Variables( X( :sex ), Y( :height ) )
is almost what I need, but it adds a plot instead of replacing it.
Is there an option for the "variables" messages to tell GraphBuilder to replace the old variables with new ones?