cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
ndowidar
Level III

Fit Line automatically to data table

Hello, 

 I would like to use the Fit Line function in JMP to automatically save the equation to my data table. The catch is that I need to do this hundreds of times, so the "Save Predicteds" option isn't very feasible. What would be the easiest way to write bivariate formula in the data table that would calculate it automatically? I am somewhat limited to the formula builder in JMP since I don't know how to write a script in JSL, unless there are clear instructions how to implement the simple Fit line code. 

 I was also made aware of the JMP Profiler feature. This would be fantastic if I could use it to optimize a variable that's is broken about 100 times. Here’s an example of the data table I put together to show how the variables are broken up.

 Briefly, I have a Response variable for a given concentration. So, fitting the X by Y would produce an equation that I could use, but since I have this equation measured about a 100 times for each Mix and Method. I want to find a way to populate those specific equations in the JMP data table so that I can calculate the Optimal Conc. for a Response equal to 1.

6 REPLIES 6
Jeff_Perkinson
Community Manager Community Manager

Re: Fit Line automatically to data table

I feel like we can get you where you want to be fairly easily but I'm not sure where that is.

2022-01-21_21-12-48.032.png

First questions from me:

With the data table you've shared here, what Fit Y by X are you doing? I think that Response is your Y and Conc. is your X but what role are you giving to Method and Mix?

 

Second questions:

You said you want to know what Conc. will give you a prediction of 1. Do you want to know that for each combination of Method and Mix? The reason I ask is because in your sample data set you only have one Conc. and Response for each unique combination of Method and Mix. I realize that this is a mock data table but, in your real data table do you have multiple Conc. and Response values for each combination of Method and Mix?

 

Finally, I'll tell you two directions I think that may help, but the answers to the questions above will help greatly in pointing you in the best direction.

 

1) The Ctrl (Window) or Cmd (Mac) key will broadcast commands. For example if you open the Big Class data table (from Help->Sample Data Library) and run Fit Y by X with Height and Weight in Y and X, respectively, and Age in the By role. You'll get one Height by Weight platform for each Age. If you hold down the Ctrl/Cmd key as you choose Fit Line and also Save Predicteds you'll get a prediction formula that takes Age into account:

 

2022-01-21_21-26-07.701.png

2) Fit Model will allow you to build a prediction equation that considers Method and Mix and give you a single prediction profiler. Again, use Big Class choose Fit Model and put Height in the Y role and add Sex, Age, and Weight as effects.

2022-01-21_21-32-48.816.png

You'll get a Least Squares report.

2022-01-21_21-33-33.623.png

You can use the red triangle menu at the top to add a Profiler.

2022-01-21_21-34-02.815.png

The Profiler may help you optimize but, again these are only directions. Until we understand exactly what you have and what you're looking for with getting the value for Concentation that will likely result in a response of 1 we can't be give you specific instruction. We just need to know more about your situation and what you're trying to get at.

-Jeff
ndowidar
Level III

Re: Fit Line automatically to data table

Jeff,

Thank you so much for the quick and helpful response! You nailed it! This is really exciting to see how to apply my data to solve an intricate problem! I’ve saved another mock example of my data in JMP to help clarify.

To answer the first question: I’m fitting the Response variable as Y and Concentration (Conc.) as X and splitting them by Method, Mix & Icon. I just added Icon since it’s another tracking variable.

Answer to the second question:

Yes! I want to know what concentration (Conc.) will give a prediction of 1. And yes, my data table has 100’s of measurements of Conc. and Response that are split by Method and Mix & Icon. 

 I applied the method (Window ctrl command) to use the Fit Y b y X and save the equations to the data table. Thank you so much! It’s been a huge relief to learn more about JMP.

 I’m still not sure how to read or fully apply the Profiler to understand what Conc., Method & Mix will give a Response = 1. But I’ll keep working on it. I feel like we’re very close!

Thanks again for all your help.

Jeff_Perkinson
Community Manager Community Manager

Re: Fit Line automatically to data table

I'm sorry for the delay in my response here.

 

The first thing I notice is that your Method and Mix columns are confounded. That is, Method A only has Mix X and Y, and Method B has only Mix Y and Z. So, if your real data looks like this there is no point in including both Mix and Method.

2022-01-24_17-23-36.166.png

After running Fit Model with only Mix and Conc. in the model you'll see a profiler like this.

2022-01-25_08-33-59.915.png

From the red triangle next to Prediction Profiler you can choose Desirability Functions.

2022-01-25_08-38-05.505.png

That will add a panel on the right side of the Profiler. You can double click on that panel and set the desirability values to match your target of 1.

2022-01-25_08-47-13.773.png

Once you've done that you can use the option to Maximize Desirability to find a Mix and Conc. that will get get you to your desired response.

 

Next, if you Ctrl-click in the Mix graph you'll get a dialog where you can lock Mix.

2022-01-25_13-54-41.613.png

Once the factor is locked the Maximize Desirability option will not change Mix. So, you'll get a Conc. for whatever level of Mix you've chosen. You can change Mix and do that again for another Mix level.

 

Finally, once the factor is locked you can choose Maximize for Each Grid Point.

2022-01-25_13-58-09.623.png

This will automatically maximize for each level of Mix.

2022-01-25_13-59-39.469.png

If you really want to include Icon you can do the same with a model with Mix and Icon. Lock them both in the Profiler and then Maximize for Each Grid Point will create a grid of all combinations of Icon and Mix (beware: that's more than 450 combinations in your sample). 

2022-01-25_14-27-34.199.png

I hope that helps. Keep the questions coming.

-Jeff
ndowidar
Level III

Re: Fit Line automatically to data table

Hi Jeff, 

 Thank you so much for the detailed response! I couldn't have done this without your help. 

 You're indeed right about the mixes being redundant. I got the same graph with my data too. I followed your instructions to set the Desirability, lock it for each grid point...etc. And it worked at the Mix & Conc. level but when I repeated it with the Icon varible I couldn't get them to show up in the table at the bottom. I'm not sure how to get that output (and put it in a new data table) so I can apply that in my next experiment. The Remembered Settings should list all the Icons but it's only including a few of them. 

 As you can see below my prediction proflier came out slightly different than yours for some reason. I don't have a nice bell curve. Would be good to know what you think I may have done different just to be sure; but since it's ultimately due to the data, I'm not sure what the difference is. 

ndowidar_1-1643240584425.png

 

 

If you could help me with that then I think that would mean we could: use the data to identify the optimal settings and use the output for a follow up run, which would be incredible! 

 

Thanks again, 

 Naeem

ndowidar
Level III

Re: Fit Line automatically to data table

Hi Jeff, 

 I re-tried using the profiler to set the Desirablity settings to 1, lock them for the mix and apply the Maximize for Each Grid Point. I discovered that it did repeat as I'd shown before but if I clicked the red arrow again to Max. for Each Grid Point, it woud add more Icons to the Remembered Settings list. So I re-read your instrucitons and realized you may want me to lock each Icon variable, which doesn't seem feasible since there's like 100 of them in one tiny graph that I'd have to click on each time. So I think that won't be very feasible. I you're able to provide a little more instruction then I'll try and repeat the analysis for Mix, Conc. and Icon again. 

 I also noticed after my analysis that although I had locked the Maximum Desirability setting for Mix, I can click on each mix and the Response number in read to the left will change. I guess that if I click on anything in the upper portion of the profiler the numbers will change but the output that's in the lower portion of the graph is set to 1 and that's what is reported in the Remembered Settings table at the bottom. 

 So by using the profiler and following your analysis and setting just the Mix at 1, does that lock all the other variable outputs for that mix? If so, why would I have to lock Conc. or Icon. And if I do indeed have to lock the Desirablity and Maximize for Each Grid for the other variables how do I do that? Icon like you said is too high a number and Conc. will change.

 Thanks so much for your help. And my apologies if I missed something in your instructions earlier. I'll keep trying in the meantime. 

 Best, 

 Naeem

ndowidar
Level III

Re: Fit Line automatically to data table

Hi Jeff, 

 I went through your instructions again and locked the Icon variables after I locked the Mix for a Response at a value of 1. That did indeed trigger JMP to ask me if I wanted to include the output for all the Icon's in the table. But just like you mentioned, it would entail accepting each Icon combination (I think) because I had to keep clicking yes. 

 So I thought about an alternative. Couldn't I use the Fit Line equation to calculate the Conc. for each Combination directly in the data table? This would be done by applying the Fit Y by X, use the ctrl+ Fit Line & save all the equations to the data table? I just don't know how to actually apply each equation to solve for Conc. by setting Response to 1. 

 I know you suggested using the Profiler instead, so I wonder what I'd be missing if used this simpler alternative. But since I'm using the data to optimize each Icon, MIx and Conc combo, then maybe I could use another method to isolate outliers and so forth. I'd still have to further analyze the data and break it up into smaller batches of Mix vs Icon & Conc to scrutinize the output a bit more. 

 

 Best, 

 Naeem