Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Shunee
Level I

Remove effects from effect summary by scripting

How can I remove certain effects in effect summary when the Pvalues exceed the value I set by scripting?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ian_jmp
Staff

Re: Remove effects from effect summary by scripting

In the 'Effects Summary', 'Remove' is just a button box with underline styling. So, alternatively, you can simulate a button press non-interactively:

names default to here(1);
dt = open("$SAMPLE_DATA/big class.jmp");

ft = dt << 
Fit Model(
	Y( :weight ),
	Effects( :age, :sex, :height ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )}
	)
);

Wait(3);
// Get the Fit Model report
ftRep = Report(ft);
// Select the rows in the report that have a p value bigger than 0,05
pVals = Matrix(ftRep[NumberColBox(2)] << get);
bigPvals = Loc(pVals > 0.05);
ftRep[TableBox(1)] << setSelectedRows(bigPvals);
// Simulate a button press to remove these terms
ftRep[ButtonBox(1)] << click;

View solution in original post

5 REPLIES 5
Highlighted
txnelson
Super User

Re: Remove effects from effect summary by scripting

The Effects Summary table is just a standard JMP Table Box().  Therefore, it will honor any  of the messages that the Table Box() object supports.  One of those messages is

     << delete row()

Here is an example taken from the Scripting Index

     Help==>Scripting Index

that illustrate the use of the delete row() message with a Table Box()

Names Default To Here( 1 );
New Window( "test",
	tb = Table Box(
		String Col Box( "string col", {"a", "b"} ),
		Number Col Box( "number col", {1, 2} )
	)
);
tb << delete row( 1 );

Determining how to point to the Table Box() you are interested in is documented in the Scripting Guide's section on Display Trees

     Help==>Books==>Scripting Guide

Jim
Highlighted
Shunee
Level I

Re: Remove effects from effect summary by scripting

I am not able to delete the rows even I use Table Box. The Log window return "unable to delete row (i)" . Is ther any other way to do it?

Usually effect summary allow us to select certain effect in the table box and click "Remove" button from the left corner to delete certain effect. Can do this by scripting? How can I select the row in table box and activate the "Remove" button to delete the selected row by scripting?

Highlighted
txnelson
Super User

Re: Remove effects from effect summary by scripting

I was able to replicate your findings.....it will not let you delete a row in that particular table.  However, there is a work around.  Take a look at the below script.  It turns out that you can delete the entire table, so what the script does, is to make a copy of the table, which then you can delete the rows you want to delete.  You can then copy the table back into the report and finally delete the old table.

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");

ft = dt << Fit Model(
	Y( :height ),
	Effects( :age, :sex, :sex * :age ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )}
	)
);

ob=vlist box();
ob<<append(report(ft)["Effect Summary"][tablebox(1)]);

ob[tablebox(1)]<<delete row(3);
wait(5);
report(ft)["Effect Summary"]<<prepend(ob[tablebox(1)]);
wait(5);
report(ft)["Effect Summary"][tablebox(2)]<<delete
Jim
Highlighted
ian_jmp
Staff

Re: Remove effects from effect summary by scripting

In the 'Effects Summary', 'Remove' is just a button box with underline styling. So, alternatively, you can simulate a button press non-interactively:

names default to here(1);
dt = open("$SAMPLE_DATA/big class.jmp");

ft = dt << 
Fit Model(
	Y( :weight ),
	Effects( :age, :sex, :height ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:weight << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )}
	)
);

Wait(3);
// Get the Fit Model report
ftRep = Report(ft);
// Select the rows in the report that have a p value bigger than 0,05
pVals = Matrix(ftRep[NumberColBox(2)] << get);
bigPvals = Loc(pVals > 0.05);
ftRep[TableBox(1)] << setSelectedRows(bigPvals);
// Simulate a button press to remove these terms
ftRep[ButtonBox(1)] << click;

View solution in original post

Highlighted
Shunee
Level I

Re: Remove effects from effect summary by scripting

Thank you very much!
Article Labels

    There are no labels assigned to this post.