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

Fit Y by X function: return equation to JMP sheet

Hello, 

 I'd like to use my data to identify the concentration at say 1x that would be the optimal concentration. So I'm trying to use the JMP Fit Y by X feature to find the equation and how it relates to the two variables I have. The Fit Y by X feature works great but now I'd like to return the equation and values to the data table. Since the data I have returns these values 100s of times, is there an easy way of returning these to the data table so that I can actually use the equations to calculate the optimal concentrations I'm after? 

 

 Thanks so much for your help! 

 

 Using JMP 16

1 ACCEPTED SOLUTION

Accepted Solutions
ndowidar
Level III

Re: Fit Y by X function: return equation to JMP sheet

Thank you so much for the help! I see now that I can save the equation as a formula. I can go down through the graphs one at a time and save the predictions and that works great. I realize though that I should probably learn how to write a script to do that instead! I'd have to do this a few hundred times.... so thank you so much for that script example. Maybe I can use it by swapping the variables that are in my table...? I'll definitely give a shot. 

 I've never written a script before. Would I just open a new script and try it out or is there somewhere in the column that I can add the script? 

 

 If you have any other suggestions, I'd appreciate the guidance. 

 

 Thanks again! 

View solution in original post

5 REPLIES 5
mzwald
Staff

Re: Fit Y by X function: return equation to JMP sheet

You can save the prediction formula of any data model you fit in a JMP report.  To do with Fit Y by X, you would first run the platform with your X and Y variables, then fit the model you want to fit (ex Fit Line), then under the graph you will see a red triangle next to the legend of the Fitted Models.  Click that triangle and choose "Save Predicteds".  That will create a formula column in your data table of that model.
Here is an example script of that:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = dt << Bivariate( Y( :Weight ), X( :Height ) );
obj << Fit Polynomial( 1, {Save Predicteds} );
ndowidar
Level III

Re: Fit Y by X function: return equation to JMP sheet

Thank you so much for the help! I see now that I can save the equation as a formula. I can go down through the graphs one at a time and save the predictions and that works great. I realize though that I should probably learn how to write a script to do that instead! I'd have to do this a few hundred times.... so thank you so much for that script example. Maybe I can use it by swapping the variables that are in my table...? I'll definitely give a shot. 

 I've never written a script before. Would I just open a new script and try it out or is there somewhere in the column that I can add the script? 

 

 If you have any other suggestions, I'd appreciate the guidance. 

 

 Thanks again! 

ndowidar
Level III

Re: Fit Y by X function: return equation to JMP sheet

I found a way to add the script as a formula for a column. I followed these steps but it's returning an error. 

1.If I do that, I think I have to remove the first line of the script since it's a formula in the the window itself; i.e there's no need to write a function to open the data set, correct?

Now all I'd have in the formula box are the two lines of code:

obj = dt << Bivariate( Y( :Weight ), X( :Height ) );
obj << Fit Polynomial( 1, {Save Predicteds} );

 2.Then all I should have to do is swap the Y and X variables with the ones in my column. 

 3. Is the Fit Polynomial equivalen to the Fit Line option or should I re-write that at "Fit Line". 

 

 Result: After I did that I got an error: Send expects scriptable object.

 

 Any suggestions? 

  

Jeff_Perkinson
Community Manager Community Manager

Re: Fit Y by X function: return equation to JMP sheet

The Save Predicteds command from the red triangle menu will save a Formula column to the data table.

2022-01-18_17-02-51.334.png

If you're looking for optimization, don't overlook the Profiler. It is tailor-made for that and will work with the formula you save from Fit Y by X.

-Jeff
ndowidar
Level III

Re: Fit Y by X function: return equation to JMP sheet

Thanks so much for the help. I'll definitely look into that Profiler option as well. What I have to do will have to be done hundreds of times, so maybe the Profiler will have a feature to just apply the equation from the data table. 

 I feel like I'm getting so close to figuring this out, it's very exciting to learn more about JMP! 

 

 Thanks again!