Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

Aug 21, 2018 2:21 PM
(3765 views)

Hi all,

To quickly orient you: I am working with ELISA data (dose-response curve) so my independent variable is dilution factor, my dependent variable is absorbance, and I have multiple time points I am looking at for multiple animals. I'd like to be able to find the EC50 - dilution at half maximal response - with a nonlinear, sigmoidal, curve fit. I am currently using a 4 parameter model (Probit 4P).

Basically, I'd like to write a script that can get the data from the parameter estimates into a table, find the midway point between the upper and lower asymptotes for each curve, and then use that value in a custom inverse prediction to get the EC50. I'm pretty sure I can do the second two parts if I could just get the dang parameter estimates!

Here's what I have for the curve fitting:

```
For ( i = 1, i <= N items (Mice), i++,
FC = Fit Curve (
Y ( :Data ),
X (:Dilution ),
Group (:Timepoint),
By(:Animal)
Fit Probit 4P,
Where (:Animal == eval(Mouse_names[i])), //thist isn't referencing the variable the way i expect but using either eval( ) or char( ) seems to be a work-around?...
SendToReport(
Dispatch(
{"Plot"},
"7",
ScaleBox,
{Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 4 ), Inc( 2 ),
Minor Ticks( 0 )}
),
Dispatch(
{"Plot"},
"6",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 0.0000001 ),
Max( 0.1 ), Inc( 2 ), Minor Ticks( 0 )}
),
Dispatch(
{"Plot"},
"13",
ScaleBox,
{Format( "Fixed Dec", 12, 0 ), Min( 0 ), Max( 4 ), Inc( 2 ),
Minor Ticks( 0 )}
),
Dispatch(
{"Plot"},
"16",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 0.0000001 ),
Max( 0.1 ), Inc( 2 ), Minor Ticks( 0 )}
),
Dispatch(
{"Probit 4P", "Plot"},
"7",
ScaleBox,
{Format( "Fixed Dec", Use thousands separator( 1 ), 12, 0 ), Min( 0 ),
Max( 4 ), Inc( 2 ), Minor Ticks( 0 )}
),
Dispatch(
{"Probit 4P", "Plot"},
"6",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 0.0000001 ),
Max( 0.1 ), Inc( 2 ), Minor Ticks( 0 )}
),
Dispatch(
{"Probit 4P", "Plot"},
"13",
ScaleBox,
{Format( "Fixed Dec", Use thousands separator( 1 ), 12, 0 ), Min( 0 ),
Max( 4 ), Inc( 2 ), Minor Ticks( 0 )}
),
Dispatch(
{"Probit 4P", "Plot"},
"16",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 0.0000001 ),
Max( 0.1 ), Inc( 2 ), Minor Ticks( 0 )}
)
)
);
FC << journal;
FC << close window;);
```

That works fine for me and I have the output of a journal with each Fit Curve with the model comparison, plot of the data, model info (including prediction model, summary of fit, *~*parameter estimates*~*, correlation of estimates, covariance of estimate, and plots of the modeled curve). I can manually right click on the parameter estimates and "Make Into Combined Data Table" but don't know how to do it in a script. Ideally, i would only have one data table at the end with columns for Animal, Parameter (growth rate, inflection point, lower asymptote, upper asymptote) Group ( these are my time points), Estimate, Std Error, Lower 95%, Upper 95%.

Any help would be greatly appreciated! Thanks!

5 REPLIES 5

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

Here is an example, not exactly your specific example (this example uses By). I don't know your expertise in navigating a report window.

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Nonlinear Examples/Bioassay.jmp" );
obj = Fit Curve( Y( :Toxicity ), X( :log Conc ), By( :formulation ) );
obj << Fit Logistic 4P( Custom Inverse Prediction( Response( 0.9 ) ) );
//you can get one table using Make Combined Data Table
est_tbl= report(obj[1])["Parameter Estimates"][TableBox(1)] << Make Combined Data Table;
est_tbl << Set Name("Parameter Estimates");
inv_tbl = report(obj[1])["Inverse Prediction"]["Predicted Values"][TableBox(1)] << Make Combined Data Table;
inv_tbl << Set Name("Inverse Prediction");
```

Hope this helps.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

Created:
Aug 22, 2018 5:49 AM
| Last Modified: Aug 22, 2018 5:50 AM
(3735 views)
| Posted in reply to message from gzmorgan0 08-22-2018

Hello,

Once you have a handle to your journal, you can navigate the journal as shown below (similar to the post by @gzmorgan0) to generate the data table of combined Parameter Estimates.

```
jrn = Current Journal();
paramEst = jrn["Parameter Estimates"][Table Box( 1 )] << Make Combined Data Table;
```

I hope this is helpful!

Wendy

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

Created:
Aug 22, 2018 10:07 AM
| Last Modified: Aug 22, 2018 10:08 AM
(3722 views)
| Posted in reply to message from Wendy_Murphrey 08-22-2018

Awesome! Thanks so much for the answer - it defintely works for exactly what I need it for!! I'm just still trying to figure out what's going on underneath your code so I can use it in different applications in the future.

Is this just indexing the journal by name, specifing that I do want the table box and making a new data table?

I had seen other responses like

`dt2 = bivRep [1] [TableBox(3)] << Make Combined Data Table;`

but couldn't figure out what was really going on. Would this one take the third table box found in the first section (?) of bivRep and write out to a new dt?

I am exploring a little but more and was able to get the Summary of Fit with

`jrn["Summary of Fit"][Table Box (1)] << Make Combined Data Table;`

but couldn't figure out how to do something like get the Correlation of Estimates for Week 5.

I tried:

`covar_pre = jrn["Covariance of Estimates"]["Week 5"][Table Box(1)] << Make Combined Table;`

And got the error:

```
Cannot subscript Display Box{400} in access or evaluation of 'Subscript' , jrn["Covariance of Estimates"]["pre"][/*###*/Table Box( 1 )]
In the following script, error marked by /*###*/
paramEst = jrn["Covariance of Estimates"]["Week 5"][/*###*/Table Box( 1 )] <<
Make Combined Data Table
```

I guess *this* output is not a table box? I am not sure what sort of data it is and am not sure how to figure it out.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

My experience in navigating a report window is essentially zero.

I searched the scripting guide for report window and didn't find much. Any resources you could point me towards?

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Extracting parameter estimates from nonlinear (sigmoidal) curve fit - scripting

Created:
Aug 22, 2018 4:15 PM
| Last Modified: Aug 22, 2018 4:21 PM
(3706 views)
| Posted in reply to message from lakepotter 08-22-2018

Use

`jrn["Correlation of Estimates"][MatrixBox(1)] << Make Combined Data Table;`

Go to Main Menu> Help >Books > JMP Scripting Guide then open the PDF and scroll to Chapter 11, Display Trees.

A JMP report is a list of nested display boxes. This will show you how to find objects and send messages.

```
jrn << show tree structure;
//or right click on a reveal button to the left of an outline box
// then select Edit, Show Tree Structure
```

Article Labels

There are no labels assigned to this post.