cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

Graph Builder: Fit of line -disable y offset?

In GraphBuilder, for fit of line, is it possible to set the y-offset fixed to 0?

7 REPLIES 7
Phil_Kay
Staff

Re: Graph Builder: Fit of line -disable y offset?

Hi @hogi ,

No, I don't think that it is. I think that you are asking to constrain the intercept to zero. For more complex modelling options like this, you need to use Fit Y by X from the Analyze menu. From the red triangle menu for Bivariate Fit you can select Fit Special... and then you can select Constrain Intercept to 0:

 

Phil_Kay_0-1680079981890.png

 

 

I hope this helps,

Phil

Re: Graph Builder: Fit of line -disable y offset?

You can fit a model as @Phil_Kay describes, save the prediction formula, and add that column to the Y axis as a function graphics element.

hogi
Level XIII

Re: Graph Builder: Fit of line -disable y offset?

Hm, I was searching for a one-click solution to get a "1:1" correlation line *) into the Graph Builder Plot, one which goes through  0/0 and runs close to the data points **)  - I guess I will write a script which just calculates the center of gravity and draws the line.

 

*)
edit:
along the idea:
- 0 % -> 0%
- 100% -> 100%
For all the cases where it's 100% clear that X and Y correlate without offset,

like a conversion of scales: any jitter around the line can just be a measurement artifact (either on the X or Y axis - or on both).

 

 **) By the way - actually I thought that a fit with constrained Y intercept goes somewhere close to the center of gravity:
no freedom for the Intercept, 1 degree of freedom to get close to the data points.

hogi_0-1680105442245.png

 

I was a bit surprised to see (red line: y not constrained, green line y=0)

hogi_3-1680105610009.png

hogi_4-1680105676128.png

hogi_5-1680105793566.png


So, calculating the center of gravity and drawing the line seems to be the better approach for what I want to do ...

David_Burnham
Super User (Alumni)

Re: Graph Builder: Fit of line -disable y offset?

When you say ""1:1" correlation line", do you want a 45-degree line i.e. y=x : if so, you can do that in Graph Builder 

 

right-click> customise> add a script using the Y Function template and set the function of x as x:

 

Y Function(x, x);

 

(ok, not a "one-click" solution, but very effective if you want a reference line for a calibration curve, or a reference line for actual versus predicted)

-Dave
hogi
Level XIII

Re: Graph Builder: Fit of line -disable y offset?

Thanks I will use the Y function to add the line.

But it will not be y = ONE times x.

 

Let's say X is measured in cm and Y is measured in inch.
Same holds for measurements of the same property at different tools - or at different times during production process.
(if I know that 0 is measured as 0)

ih
Super User (Alumni) ih
Super User (Alumni)

Re: Graph Builder: Fit of line -disable y offset?

You can create a new variable inside the platform with a formula equal to the x variable (right click on x variable, formula,, and okay), then add that as a y variable and draw a function element on the chart.  Remove that from the other graph elements and only select the transformed variable in the function. It does take a few clicks and necessitates custom y axis and chart labels:

 

ih_1-1680112439902.png

ih_0-1680112280954.png

 

Script to reproduce charts:

View more...
Names Default To Here( 1 );

dt = Open( "$Sample_data/iris.jmp" );

dt << Graph Builder(
	Transform Column( "Transform[Sepal length]", Formula( :Sepal length ) ),
	Size( 491, 506 ),
	Variables(
		X( :Sepal length ),
		Y( :Petal length ),
		Y( :"Transform[Sepal length]"n, Position( 1 ) )
	),
	Elements( Points( X, Y( 1 ), Legend( 6 ) ), Formula( X, Y( 2 ), Legend( 8 ) ) ),
	SendToReport(
		Dispatch( {"Points"}, "", OutlineBox, {Close( 0 )} ),
		Dispatch( {"Formula"}, "", OutlineBox, {Close( 0 )} )
	)
);

dt << Graph Builder(
	Transform Column( "Transform[Sepal length]", Formula( :Sepal length ) ),
	Size( 443, 462 ),
	Show Control Panel( 0 ),
	Variables(
		X( :Sepal length ),
		Y( :Petal length ),
		Y( :"Transform[Sepal length]"n, Position( 1 ) )
	),
	Elements( Points( X, Y( 1 ), Legend( 6 ) ), Formula( X, Y( 2 ), Legend( 8 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				8,
				Level Name( 0, "1:1 Line", Item ID( "Transform[Sepal length]", 1 ) )
			)}
		),
		Dispatch(
			{},
			"graph title",
			TextEditBox,
			{Set Text( "Petal length is usually smaller than Sepal length" )}
		),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "Petal length" )} )
	)
);
hogi
Level XIII

Re: Graph Builder: Fit of line -disable y offset?

Argh, I just thought again - and remembered a wonderful micro-"lecture" that @jules gave in the DataViz breakout room at Discovery Summit Europe 2023 - how easy you can solve puzzles with regression - by showing the squared residuals in the plot via 

Open( "$SAMPLE_DATA/../Scripts/InteractiveDemos/DemonstrateRegression.jsl" );

After dragging the points and lines one can sees that my puzzles with the constrained fit were actually the ordinary thing with fit outliers - and the squared weighting of the residuals - and a fit line which definitely doesn't hit the center of gravity:

hogi_0-1680168055422.png
hogi_1-1680168078398.png

Recommended Articles