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
MathStatChem
Level VI

Create prediction expression display based on column formula

I would like to create a formatted prediction expression, based on a column formula, in a custom report window.  When I fit a linear model using Fit Least Squares, in the model report, I can turn on the display of the prediction expression, which displays a formatted "picture" view of the equation.

 

I can then save the equation to the data table as a column with a formula.  

 

Now I want to select that column and display a prediction expression for the formula saved to the column, all by itself, in a new report window.  

 

Is there a way to do this with JSL?  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: Create prediction expression display based on column formula

If you're looking for a picture of the prediction expression you can use Expr As Picture().

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Drug.jmp" );
obj = dt << Fit Model(
	Y( :y ),
	Effects( :Drug, :x ),
	Personality( Standard Least Squares ),
	Emphasis( Minimal Report ),
	Run
);
obj << Prediction Formula;


New Window( "Example",
	Lineup Box( N Col( 1 ), spacing( 10 ),
		Text Box( "Column Formula" ),
		Border Box( Left( 10 ), Right( 10 ), bottom( 10 ), top( 10 ), sides( 15 ),
			Expr As Picture( dt:pred formula y << get formula )
		)
	)
);

2020-09-10_13-27-50.507.png

-Jeff

View solution in original post

3 REPLIES 3
Highlighted
txnelson
Super User

Re: Create prediction expression display based on column formula

You can simply retrieve the formula with a <<get formula message passed to the column.

Names Default To Here( 1 );
dt = New Table( "Example",
	add rows( 10 ),
	New Column( "The Column", formula( Random Integer( 1, 100 ) ) )
);

theFormla = dt:The Column << get formula;
Jim
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: Create prediction expression display based on column formula

If you're looking for a picture of the prediction expression you can use Expr As Picture().

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Drug.jmp" );
obj = dt << Fit Model(
	Y( :y ),
	Effects( :Drug, :x ),
	Personality( Standard Least Squares ),
	Emphasis( Minimal Report ),
	Run
);
obj << Prediction Formula;


New Window( "Example",
	Lineup Box( N Col( 1 ), spacing( 10 ),
		Text Box( "Column Formula" ),
		Border Box( Left( 10 ), Right( 10 ), bottom( 10 ), top( 10 ), sides( 15 ),
			Expr As Picture( dt:pred formula y << get formula )
		)
	)
);

2020-09-10_13-27-50.507.png

-Jeff

View solution in original post

Highlighted
MathStatChem
Level VI

Re: Create prediction expression display based on column formula

Thanks, that's what I needed.  I knew there was a way to do it, I just couldn't remember the Expr as Picture() box display object.  

Article Labels