cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
sebbeyer
Level II

get values of 5 number summary from boxplot graph in graph builder

Hey JMP-community,

 

I need help with a JSL script. I would like to work with multible values from the "5 number summary" of boxplot graphs in the graph builder. Do you know how to get these values - f.e. in a list or a matrix? to work with these after the graph is build?

 

sebbeyer_1-1650443280707.png

 

 

BR and thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions

Re: get values of 5 number summary from boxplot graph in graph builder

This example should give you the essential ideas and approach:

 

Names Default to Here( 1 );

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

// launch platform and analyze separately by :sex and save reference to analysis layer
dist = dt << Distribution( Y( :weight ), By( :sex ) );

// get reference to report layer
rpt = dist << Report;

// get reference to all Qunatiles outline boxes
quantile table = rpt << XPath( "//OutlineBox[text()='Quantiles']" );
n rpts = N Items( quantile table );

// prepare empty container for all five-point summaries
summary = J( 5, n rpts, . );

// iterate over all Quantile reports
For( r = 1, r <= n rpts, r++,
	summary[0,r] = Matrix( (quantile table[r])[1][NumberColBox(1)] << Get( { 11, 7, 6, 5, 1 } ) );
);

// survace matrix as a new data table
As Table( summary );

dist << Close Window;

View solution in original post

5 REPLIES 5

Re: get values of 5 number summary from boxplot graph in graph builder

I would not try to extract this information from Graph Builder. I would use another platform instead. The Distribution platform computes these quantiles for you. You can open it as an invisible platform, extract the values, and then close it. See this example:

 

Names Default to Here( 1 );

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

dist = dt << Distribution( Y( :weight ), Invisible );
rpt = dist << Report;

five pt summary = { min, q1, med, q3, max } = rpt["Quantiles"][NumberColBox(1)] << Get( { 11, 7, 6, 5, 1 });

dist << Close Window;
sebbeyer
Level II

Re: get values of 5 number summary from boxplot graph in graph builder

Thanks alot for you reply, that did in fact help me. I have just one open question left: When I create the distribution all values from all Boxes are put together. Is there an option to create the distribution for different X values? I try to explain it in my example above your post. There are 5 Boxes for different x values (here EC1, EC2, LS20,...) Is it possible to create these distributions for each different X value?

 

BR

ian_jmp
Level X

Re: get values of 5 number summary from boxplot graph in graph builder

Adding in a grouping or a 'by' variable makes the method of @Mark_Bailey a little more complex (but perfectly doable). As an alternative, though, you could build on this:

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( exg = By( :sex ), exm = Mean( :height ), exMax = Max(:height) );
Print(exg, exm, exMax);
sebbeyer
Level II

Re: get values of 5 number summary from boxplot graph in graph builder

Thank you. I have tested the Group by function in the script, but it did not turn out as expected... I have adapted @markbailey s script with: dist << Group By (X (:sex));

Any suggestions what might be the problem here?

 

BR and thank you in advance

 

Names Default to Here( 1 );

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

dist = dt << Distribution( Y( :weight ), Invisible );
dist << Group By (X( :Sex));
rpt = dist << Report;

five pt summary = { min, q1, med, q3, max } = rpt["Quantiles"][NumberColBox(1)] << Get( { 11, 7, 6, 5, 1 });

dist << Close Window;

 

Re: get values of 5 number summary from boxplot graph in graph builder

This example should give you the essential ideas and approach:

 

Names Default to Here( 1 );

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

// launch platform and analyze separately by :sex and save reference to analysis layer
dist = dt << Distribution( Y( :weight ), By( :sex ) );

// get reference to report layer
rpt = dist << Report;

// get reference to all Qunatiles outline boxes
quantile table = rpt << XPath( "//OutlineBox[text()='Quantiles']" );
n rpts = N Items( quantile table );

// prepare empty container for all five-point summaries
summary = J( 5, n rpts, . );

// iterate over all Quantile reports
For( r = 1, r <= n rpts, r++,
	summary[0,r] = Matrix( (quantile table[r])[1][NumberColBox(1)] << Get( { 11, 7, 6, 5, 1 } ) );
);

// survace matrix as a new data table
As Table( summary );

dist << Close Window;