Choose Language Hide Translation Bar
Highlighted
wlancaster1
Community Trekker

Inaccurate Saved Script - Fit Group Arranged Rows

Hi all.

I am trying to script a bivariate report, with fit groups arranged in rows of 2.

Below is what the report looks like after manually creating it, using the football sample data.

11377_JMP football example.PNG

Here is the script obtained when clicking on the red arrow for one fit group and selecting "save script for all objects"

New Window( "Football - Bivariate",

  V List Box(

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "db" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "db" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "db" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "dl" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "dl" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "dl" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "fb" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "fb" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "fb" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "hb" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "hb" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "hb" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "ib" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "ib" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "ib" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "ki" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "ki" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "ki" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "ob" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "ob" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "ob" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "ol" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "ol" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "ol" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "qb" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "qb" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "qb" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "te" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "te" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "te" )

  ),

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ), Where( :Position == "wr" ) ),

  Bivariate( Y( :Weight ), X( :Fat ), Where( :Position == "wr" ) ),

  <<{Arrange in Rows( 2 )},

  Where( :Position == "wr" )

  )

  )

);

And finally, here is what the result looks like:

11390_JMP football example 2.PNG

I'm not sure why this is happening. Why is the saved script not accurate to what it was saved from?

Why is the "position" grouping appearing outside of the"fit group" box?

Why is the next fit group placed adjacent to that text box, instead of below it?

How would one fix this, or write an actual script to replicate the first picture?

Thanks

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
wlancaster1
Community Trekker

Re: Inaccurate Saved Script - Fit Group Arranged Rows

After 3 years, I've finally stumbled upon the general solution I was seeking. Until this point I had been dynamically creating the list of fit groups that JMP would generate, and then using xpath to delete the stupid text boxes and update the titles of the fit group. Even still, the result would not be fully identical to the result from the JMP GUI, since making combined data tables would not create columns for the categories in the "where" clause.

 

If anyone is listening, this would have been so much easier if the documentation were better. Nothing I could find anywhere would have lead me to believe this is the way it could be done. One shouldn't have to learn things like this through random trial and error experimentation.

 

See below:

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

//the dynamic script to do this analysis
//using the same inputs as the GUI window, with no other knowledge of the DT's contents
//The result is identical to the result generated from the GUI
Fit Group(
	Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
	Oneway(
		Y( :height ),
		X( :sex ),
		//A lot of this was generated due to preferences I had set.
		Automatic Recalc( 1 ),
		Means and Std Dev( 1 ),
		Box Plots( 1 ),
		Mean Diamonds( 1 ),
		Mean Error Bars( 1 ),
		Std Dev Lines( 1 ),
		X Axis Proportional( 0 ),
		Points Jittered( 1 )
	),
	<<{Arrange in Rows( 2 )},
	by(:age)
);

/*
The result JMP returns from "Save Script" > "To Script Window (All Objects)"
Returns a huge mess with fit groups and text boxes containing the "where" clauses

When making a combined data table of any of the resulting tables (such as means/std),
	This report will *NOT* create columns with info from the "where" clauses
*/
New Window( "Big Class - Oneway",
	V List Box(
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 12 ),
			Where( :age == 12 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 13 ),
			Where( :age == 13 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 14 ),
			Where( :age == 14 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 15 ),
			Where( :age == 15 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 16 ),
			Where( :age == 16 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 17 ),
			Where( :age == 17 )
		)
	)
);

View solution in original post

0 Kudos
4 REPLIES 4
txnelson
Super User

Re: Inaccurate Saved Script - Fit Group Arranged Rows

Change the script to:

New Window( "Football - Bivariate",

  V List Box(

  Fit Group(

  Bivariate( Y( :Height ), X( :Fat ),by(:Position)  ),

  Bivariate( Y( :Weight ), X( :Fat ), by(:Position))

  <<{Arrange in Rows( 2 )}

  )));

Jim
wlancaster1
Community Trekker

Re: Inaccurate Saved Script - Fit Group Arranged Rows

Thanks for the response!

This almost gets what I want - but now it shows all the height plots (two by two) followed by all the weight plots.

Can it be scripted so that the height/weight plots are side by side, grouped by position? And if a height/weight plot is missing, it just shows one plot and a blank area?

0 Kudos
txnelson
Super User

Re: Inaccurate Saved Script - Fit Group Arranged Rows

 

New Window( "Football - Bivariate"

  V List Box(

    Fit Group( 

  Bivariate( Y( :Height, :Weight ), X( :Fat ),by(:Position)  ),

  <<{Arrange in Rows( 2 )}

  )));

 

Jim
0 Kudos
wlancaster1
Community Trekker

Re: Inaccurate Saved Script - Fit Group Arranged Rows

After 3 years, I've finally stumbled upon the general solution I was seeking. Until this point I had been dynamically creating the list of fit groups that JMP would generate, and then using xpath to delete the stupid text boxes and update the titles of the fit group. Even still, the result would not be fully identical to the result from the JMP GUI, since making combined data tables would not create columns for the categories in the "where" clause.

 

If anyone is listening, this would have been so much easier if the documentation were better. Nothing I could find anywhere would have lead me to believe this is the way it could be done. One shouldn't have to learn things like this through random trial and error experimentation.

 

See below:

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

//the dynamic script to do this analysis
//using the same inputs as the GUI window, with no other knowledge of the DT's contents
//The result is identical to the result generated from the GUI
Fit Group(
	Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
	Oneway(
		Y( :height ),
		X( :sex ),
		//A lot of this was generated due to preferences I had set.
		Automatic Recalc( 1 ),
		Means and Std Dev( 1 ),
		Box Plots( 1 ),
		Mean Diamonds( 1 ),
		Mean Error Bars( 1 ),
		Std Dev Lines( 1 ),
		X Axis Proportional( 0 ),
		Points Jittered( 1 )
	),
	<<{Arrange in Rows( 2 )},
	by(:age)
);

/*
The result JMP returns from "Save Script" > "To Script Window (All Objects)"
Returns a huge mess with fit groups and text boxes containing the "where" clauses

When making a combined data table of any of the resulting tables (such as means/std),
	This report will *NOT* create columns with info from the "where" clauses
*/
New Window( "Big Class - Oneway",
	V List Box(
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 12 ),
			Where( :age == 12 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 13 ),
			Where( :age == 13 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 14 ),
			Where( :age == 14 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 15 ),
			Where( :age == 15 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 16 ),
			Where( :age == 16 )
		),
		Fit Group(
			Bivariate( Y( :height ), X( :weight ), Automatic Recalc( 1 ) ),
			Oneway(
				Y( :height ),
				X( :sex ),
				Automatic Recalc( 1 ),
				Means and Std Dev( 1 ),
				Box Plots( 1 ),
				Mean Diamonds( 1 ),
				Mean Error Bars( 1 ),
				Std Dev Lines( 1 ),
				X Axis Proportional( 0 ),
				Points Jittered( 1 ),
				SendToReport(
					Dispatch(
						{},
						"Oneway Plot",
						FrameBox,
						{DispatchSeg( Box Plot Seg( 1 ), Line Color( "Red" ) ),
						DispatchSeg( Box Plot Seg( 2 ), Line Color( "Red" ) )}
					)
				)
			),
			<<{Arrange in Rows( 2 )},
			Where( :age == 17 ),
			Where( :age == 17 )
		)
	)
);

View solution in original post

0 Kudos