BookmarkSubscribeRSS Feed
Highlighted
djhanson

Community Trekker

Joined:

Jun 23, 2011

Means/Anova table - is there a JSL variable/command to reference p-value?

I'm working with a One Way chart in JSL. But rather than select the Mean/Anova summary table (containing the p-value), I would rather display the p-value by itself in a separate text box below the chart. Does anyone happen to know if JMP's p-value can be referenced via a JMP command/variable? thx... dj
3 REPLIES

Re: Means/Anova table - is there a JSL variable/command to reference p-value?

There isn't a function specifically designed to retrieve a p-value from a report. However, all contents of a report can be referenced and extracted by referring to the display tree associated with the report. The syntax for doing this is described in Chapter 6 of the Scripting Guide (Help>Books)

Re: Means/Anova table - is there a JSL variable/command to reference p-value?

I've had a go at this myself, and come up with the following script which writes the P value from the ANOVA table in the bottom right-hand corner of the chart. It would be neater however if I could extract the low and high values of both axes from the tree structure - and I don't know how to do that. Can anyone tell me how it's done?

 

 

dt = Open( "$SAMPLE_DATA/Membrane.jmp" );
anova = Oneway( Y( :Count1 ), X( :Brand ), Means( 1 ), Box Plots( 0 ), Mean Diamonds( 1 ) );
anova << show tree structure;
// Find out where the P value actually is;
anovareport = anova << report;
anovatable = anovareport[Number Col Box( 6 )] << make into data table;
// Extract the ANOVA table;
Pval = Column( anovatable, "Prob > F" )[1];
// Extract the P value from the ANOVA table;
Show( Pval );
/*
Work out where to put it on the chart. If we want it on the right at the bottom,
we'll need the lowest Y value plotted and the number of X values, because the X
axis actually seems to run from 1 to Xmax, even though the points are grouped
into categories.
*/
Ymin = Min( Column( dt, "Count1" ) << get values );
Xmax = N Row( dt );
Show( Ymin );
Show( Xmax );
anovareport[FrameBox( 1 )] << Add Graphics Script(
	Text( Right Justified, {20, Ymin}, " P Value = " || Char( Pval, 10, 4 ) )
);
// Tidy up the screen so we can see the analysis;
anovatable << minimize window;
dt << minimize window;
Window( "Show Tree Structure" ) << minimize window;
// End of program;
John_Powell_JMP

Joined:

May 30, 2014

Re: Means/Anova table - is there a JSL variable/command to reference p-value?

I'm not sure why there's html style lines in the jsl above, but here's a cleaned up version for anyone who finds it useful:

dt = Open( "$SAMPLE_DATA/Membrane.jmp" );
anova = Oneway( Y( :Count1 ), X( :Brand ), Means( 1 ), Box Plots( 0 ), Mean Diamonds( 1 ) );
anova << show tree structure;
// Find out where the P value actually is;
anovareport = anova << report;
anovatable = anovareport[Number Col Box( 6 )] << make into data table;
// Extract the ANOVA table;
Pval = Column( anovatable, "Prob > F" )[1];
// Extract the P value from the ANOVA table;
Show( Pval );
/*
Work out where to put it on the chart. If we want it on the right at the bottom,
we'll need the lowest Y value plotted and the number of X values, because the X
axis actually seems to run from 1 to Xmax, even though the points are grouped
into categories.
*/
Ymin = Min( Column( dt, "Count1" ) << get values );
Xmax = N Row( dt );
Show( Ymin );
Show( Xmax );
anovareport[FrameBox( 1 )] << Add Graphics Script(
	Text( Right Justified, {20, Ymin}, " P Value = " || Char( Pval, 10, 4 ) )
);
// Tidy up the screen so we can see the analysis;
anovatable << minimize window;
dt << minimize window;
Window( "Show Tree Structure" ) << minimize window;
// End of program;