Choose Language Hide Translation Bar
Highlighted
Level III

## Is it possible to use a custom equation to fit the data in graph builder?

Hi!

I've used graph builder to plot the data with grouped X (as shown in the attached image).  I wanted to fit all three curves using an exponential growth function. I only found Line of Fit and Smoother functions, but these are not what I would like to do.  I was wondering if it is possible to customize the fitting equation and also display the confidence interval of the fit as well as the statistics of the fit (e.g. R^2, F-test, equation) in the graph?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User

## Re: Is it possible to use a custom equation to fit the data in graph builder?

I think your latest graph has taken Graph Builder built in functionality to it's max.  To go where you seem to want to take it, I think you need to study up on the ability to add any graphical items to Graph Builder or any other of the graphical outputs, using the adding of graphics scripts to the outputs frame boxes.  The interactive form of this, is surfaced by right clicking on a graph and selecting "Customize".  This entrance to the graphical scripting world in JMP, provides one with some sample templates and scripts.  However, this simple introduction, can be expanded within the JSL environment, to do just about anything you want in your graph.

I suggest you read the Scripting Guide, but that is a pretty big bite.  So at a minimum, you need to read the section on Scripting Graphs in the Scripting Guide.

Jim
8 REPLIES 8
Highlighted
Super User

## Re: Is it possible to use a custom equation to fit the data in graph builder?

By using the two axis option you can separate 2 Y columns into independent items.  Y column 1 is your actual values, and Y column 2 is the resulting value for the exponential growth function.  Here is an example using the attached data table with the embedded script.  You can also use the <<add graphic script to add to any graph and function, etc.  That is another option for doing what you want

Jim
Highlighted
Level III

## Re: Is it possible to use a custom equation to fit the data in graph builder?

@txnelson  Thanks for your reply.  I tried to use your method to do the fitting, however, I don't know how to set up the if statement when there are three conditions (I have three concentrations, please see the attached data table).  Can you please show me how to set up the if statement for my case?  I also found another method that Julian suggested Adding a regression line with known slope in Graph Builder.  It worked for my plot (attached image).  However, I still don't know how to add a confidence interval band to each fit.  Is that something possible to do?  Thanks

Highlighted
Staff

## Re: Is it possible to use a custom equation to fit the data in graph builder?

You can using any fitting platform in JMP and save the selected model as a column formula. Graph Builder has a graphics element called formula that uses the custom model. Drag the saved model to the Y drop zone, then change the plotting element to Formula.

Learn it once, use it forever!
Highlighted
Level III

## Re: Is it possible to use a custom equation to fit the data in graph builder?

Hi @markbailey,

I tried the method you suggested.  I created a separate column for the fitted formula.  I then dragged the column to the Y drop and changed the plotting element to Formula (the third icon from the top right).  However, I can only see the fitting curve without the raw data points.  I tried to drag the raw data point column to Overlay, but it still didn't show the data points.  Also, is it possible to draw the confidence interval around the fitted curve?

Thank you!

Highlighted
Super User

## Re: Is it possible to use a custom equation to fit the data in graph builder?

@CYLiaw If you take a look at the method that I suggested, you will see that what you need to do to get the points and the line displayed is to drag both the actual and the predicted values to the Y axis, and the right click on the axis settings and move one of the 2 columns to the right axis.

Jim
Highlighted
Level III

## Re: Is it possible to use a custom equation to fit the data in graph builder?

Hi @txnelson thanks for the tip.  The plot looks much better now (please see the attached image).  However, I still don't know how to add the confidence interval of the fit.  I also tried to use the nonlinear fitting (analyze-->specialized modeling -->nonlinear), but it didn't output any confidence interval information.  I was just wondering if it is possible to add the confidence interval manually in JMP?

Highlighted
Super User

## Re: Is it possible to use a custom equation to fit the data in graph builder?

I think your latest graph has taken Graph Builder built in functionality to it's max.  To go where you seem to want to take it, I think you need to study up on the ability to add any graphical items to Graph Builder or any other of the graphical outputs, using the adding of graphics scripts to the outputs frame boxes.  The interactive form of this, is surfaced by right clicking on a graph and selecting "Customize".  This entrance to the graphical scripting world in JMP, provides one with some sample templates and scripts.  However, this simple introduction, can be expanded within the JSL environment, to do just about anything you want in your graph.

I suggest you read the Scripting Guide, but that is a pretty big bite.  So at a minimum, you need to read the section on Scripting Graphs in the Scripting Guide.

Jim
Highlighted
Staff

## Re: Is it possible to use a custom equation to fit the data in graph builder?

Do not put the data column in the overlay role. Drag the data column to the Y role, just inside the plotting frame. You should see a blue shape appear and the plot should update to show you what will happen. Do not let up on the mouse button until you see the markers added to the plot of the graph of the function.

This process is described in Help > JMP Documentation > Essential Graphing. See the Graph Builder chapters.

Learn it once, use it forever!
Article Labels

There are no labels assigned to this post.