cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
trevorphysics
Level II

Need to display and pull x-intercept from a linear fit

I am taking a certain range of data points around the straight part of my curve, and attempting to extract an x-intercept out of it using a linear fit. I can display an equation for the line but can't seem to do much with it.

 

At the very least, I want to grab that equation, solve for x when y = 0 and then display that number below the graph.

 

What would be the best way to go about pulling this information out?

 

In an ideal scenario, I could display the entire data range, but only fit the range of data points that I have currently shown as well.

 

 

Thanks you for your help.

 

 

What it ideally should look like:

Turn-onVoltage.png

My Plot with the data filter:

x-intercept.png

The code:

Graph Builder(
	Size( 618, 525 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables( X( :V1 ), Y( :I1 ), Page( :Sweep Name ), Overlay( :Test Count ) ),
	Elements(
		Line Of Fit( X, Y, Legend( 18 ), Confidence of Fit( 0 ) ),
		Points( X, Y, Legend( 19 ) )
	),
	Local Data Filter(
		Add Filter(
			columns( :I1, :Test Count ),
			Where( :I1 >= 0.003 & :I1 <= 0.008 ),
			Where( :Test Count == "1" ),
			Display( :Test Count, N Items( 15 ), Find( Set Text( "" ) ) )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"I1",
			ScaleBox( 2 ),
			{Min( 0 ), Max( 0.008 ), Inc( 0.001 ), Minor Ticks( 1 )}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "On Voltage" )} )
	)
);  

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Need to display and pull x-intercept from a linear fit

Since you are using a filter and then fitting a line to that small subset, use Fit Model to fit the line. That way you have the Inverse Prediction option from the red popup menu under Estimates > Inverse Prediction. Put your Y as 0 and JMP will find your X and even provide a 95% confidence interval for the X.

Dan Obermiller

View solution in original post

Georg
Level VII

Re: Need to display and pull x-intercept from a linear fit

Performing the great idea of @Dan_Obermiller this may look as follows:

Names Default To Here( 1 );

// generate data
dt = New Table( "Characteristic curve",
	add rows( 21 ),
	New Column( "V", set values( Matrix( -10 :: 10 ) / 10 ) ),
	New Column( "I", set each value( If( Exp( :V ) < 1.5, 0, Exp( :V ) - 1.5 ) ) )
);
dt << show window( 0 );

// create a dashboard to display all windows
nw = New Window( "Dashboard Inverse Prediction",
	H List Box( vlb_left = V List Box(), vlb_right = V List Box() ),
	<<on close(
		Close( dt, NoSave );
		Close( result_dt, NoSave );
	)
);

// fit model with inverse prediction and place into dashboard 
vlb_right << append(
	fm_obj = dt << Fit Model(
		Y( :I ),
		Effects( :V ),
		Personality( "Standard Least Squares" ),
		Emphasis( "Effect Leverage" ),
		Run(
			:I << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
			Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
			Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ), Inverse Prediction( Response( 0 ), Term Value( V( . ) ) )}
		),
		Local Data Filter( Conditional, Close Outline( 1 ), Add Filter( columns( :I ), Where( :I >= 0.2 ) ) )
	)
);

// get report and make into data table
tb_lst = Report( fm_obj ) << xpath( "//TableBox" );
result_dt = tb_lst[N Items( tb_lst )] << make data table;
result_dt << show window( 0 );

// and fill into dashboard
vlb_left << append( outline box("Inverse Prediction", dg1 = result_dt << new data box()) );
dg1 << close side panels( 1 );
dg1 << set height( 30 );

// place GraphBuilder into dashboard
vlb_left << append(// visualize
	dt << Graph Builder(
		show control panel( 0 ),
		Variables( X( :V ), Y( :I ) ),
		Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
	)
);
vlb_left << append( dg2 = dt << new data box() );
dg2 << close side panels( 1 );





Georg

View solution in original post

2 REPLIES 2

Re: Need to display and pull x-intercept from a linear fit

Since you are using a filter and then fitting a line to that small subset, use Fit Model to fit the line. That way you have the Inverse Prediction option from the red popup menu under Estimates > Inverse Prediction. Put your Y as 0 and JMP will find your X and even provide a 95% confidence interval for the X.

Dan Obermiller
Georg
Level VII

Re: Need to display and pull x-intercept from a linear fit

Performing the great idea of @Dan_Obermiller this may look as follows:

Names Default To Here( 1 );

// generate data
dt = New Table( "Characteristic curve",
	add rows( 21 ),
	New Column( "V", set values( Matrix( -10 :: 10 ) / 10 ) ),
	New Column( "I", set each value( If( Exp( :V ) < 1.5, 0, Exp( :V ) - 1.5 ) ) )
);
dt << show window( 0 );

// create a dashboard to display all windows
nw = New Window( "Dashboard Inverse Prediction",
	H List Box( vlb_left = V List Box(), vlb_right = V List Box() ),
	<<on close(
		Close( dt, NoSave );
		Close( result_dt, NoSave );
	)
);

// fit model with inverse prediction and place into dashboard 
vlb_right << append(
	fm_obj = dt << Fit Model(
		Y( :I ),
		Effects( :V ),
		Personality( "Standard Least Squares" ),
		Emphasis( "Effect Leverage" ),
		Run(
			:I << {Summary of Fit( 1 ), Analysis of Variance( 1 ), Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
			Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
			Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 ), Inverse Prediction( Response( 0 ), Term Value( V( . ) ) )}
		),
		Local Data Filter( Conditional, Close Outline( 1 ), Add Filter( columns( :I ), Where( :I >= 0.2 ) ) )
	)
);

// get report and make into data table
tb_lst = Report( fm_obj ) << xpath( "//TableBox" );
result_dt = tb_lst[N Items( tb_lst )] << make data table;
result_dt << show window( 0 );

// and fill into dashboard
vlb_left << append( outline box("Inverse Prediction", dg1 = result_dt << new data box()) );
dg1 << close side panels( 1 );
dg1 << set height( 30 );

// place GraphBuilder into dashboard
vlb_left << append(// visualize
	dt << Graph Builder(
		show control panel( 0 ),
		Variables( X( :V ), Y( :I ) ),
		Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
	)
);
vlb_left << append( dg2 = dt << new data box() );
dg2 << close side panels( 1 );





Georg