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

- 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

Created:
Jun 23, 2020 4:33 AM
| Last Modified: Jun 23, 2020 5:53 AM
(1079 views)

Hi all,

I'm trying to get a vertex point from bivariate graph

as so far, I get the extract the parameter with script and calculate it by excel sheet.

I'm quite sure finding vertex function is included in JMP but I couldn't find it.

Is there any way to get vertex directly?

Thank you

<script that I used to extract the parameter>

```
dt = Current data Table ();
biv=Bivariate(
Y( :contrast_100cm ),
X( :Offset_Z ),
Fit Polynomial( 2, {Line Color( {212, 73, 88} )} ),
Where( :site == "Para#4" )
);
rbiv = biv << report;
rbiv[tablebox(4)]<<make data table("Parameter table");
```

2 ACCEPTED SOLUTIONS

Accepted Solutions

Highlighted

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

Created:
Jun 23, 2020 8:23 AM
| Last Modified: Jun 23, 2020 8:24 AM
(1051 views)
| Posted in reply to message from Brad_Park 06-23-2020

Or, another approach is to use Fit Model, use the Response Surface macro so that JMP sets the response surface attribute. Then you will get a response surface output that solves for the critical values.

I had JMP create this script with some data that I made up.

```
Fit Model(
Y( :contrast_100cm ),
Effects( :Offset_Z & RS, :Offset_Z * :Offset_Z ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:contrast_100cm << {Summary of Fit( 0 ), Analysis of Variance( 0 ),
Parameter Estimates( 0 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
),
SendToReport(
Dispatch(
{"Response contrast_100cm", "Whole Model"},
"Summary of Fit",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response contrast_100cm", "Whole Model"},
"Analysis of Variance",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response contrast_100cm", "Whole Model"},
"Parameter Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response contrast_100cm"},
"Response Surface",
OutlineBox,
{Close( 0 )}
)
)
)
```

Here is the part of the output that finds the critical value.

Dan Obermiller

Highlighted

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

As I have posted many times, the **Send to Report()** and **Dispatch()** arguments are intended for JMP to save customization. They are not intended for users. Of course, you can use them. But there are better ways.

It appears that you want to add the answer to the plot. This example illustrates how to do that.

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// fit quadratic polynomial interpolating function
biv = dt << Bivariate(
Y( :weight ),
X( :height ),
Fit Line
);
// get reference to report layer
rbiv = biv << Report;
// get parameter estimates
parm = rbiv["Parameter Estimates"][Number Col Box( 1 )] << Get As Matrix;
// compute x intercept
ans = -parm[1] / parm[2];
rbiv[FrameBox(1)] << Add Graphics Script(
Text( { 52.5, 160 }, "X intercept is " || Char( ans ) )
);
```

Learn it once, use it forever!

8 REPLIES 8

Highlighted
##

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

Re: Finding vertex of bivariate graph

JMP does not have a solver as such. But you are fitting a quadratic polynomial interpolating function so you only need to set the first derivative with respect to Offset_Z equal to zero and solve for Offset_Z. I assume that by "vertex" you mean the minimum or maximum of the function.

```
Names Default To Here( 1 );
// example of data
dt = Current Data Table();
// fit quadratic polynomial interpolating function
biv = dt << Bivariate(
Y( :contrast_100cm ),
X( :Offset_Z ),
Fit Polynomial( 2, {Line Color( {212, 73, 88} )} ),
Where( :site == "Para#4" )
);
// get reference to report layer
rbiv = biv << Report;
// get parameter estimates
parms = rbiv[NumberColBox( 1 )] << Get As Matrix;
// compute extremum
extremum = -parms[2] / (2*parms[3]);
Show( parms, extremum );
```

Learn it once, use it forever!

Highlighted
##

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

Re: Finding vertex of bivariate graph

Thank you for kind answer.

Because you explained each code by remark, It was easy to understand.

I was trying to modify your code to find out the x intercept in linear function.

but nothing was come out.

Actually I really don't know how "show function" works.

Could you please help me to solve this?

Thank you

Highlighted
##

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

Re: Finding vertex of bivariate graph

Created:
Jul 3, 2020 4:53 AM
| Last Modified: Jul 3, 2020 4:54 AM
(855 views)
| Posted in reply to message from Brad_Park 07-03-2020

The **Show()** function writes text based on its arguments to the Log window, which is not open by default. Select **View > Log** if you are using Windows or **Window > Log** if you are using Macintosh.

I modified the script to estimate the x-intercept, assuming that it exists in the real plane. It is just the quadratic solution for the roots.

```
Names Default To Here( 1 );
// example of data
x = -5::5;
dt = New Table( "Non-Linear Data",
New Column( "X", Numeric, Continuous, Values( x ) ),
New Column( "Y", Numeric, Continuous, Values( x^2 - x - 12 ) )
);
// fit quadratic polynomial interpolating function
biv = dt << Bivariate(
Y( :Y ),
X( :X ),
Fit Polynomial( 2 )
);
// get reference to report layer
rbiv = biv << Report;
// get parameter estimates
parm = rbiv["Parameter Estimates"][NumberColBox( 1 )] << Get As Matrix;
// compute x intercept
ans = parm[2]^2 - 4*parm[3]*parm[1];
x intercepts = If( ans > 0,
(-parm[2] + { -1, 1 } * Sqrt( ans )) / (2*parm[3]);
);
Show( parm, x intercepts );
```

Learn it once, use it forever!

Highlighted
##

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

Re: Finding vertex of bivariate graph

Hi Makrbailey,

Can I ask for more things?

I slightly changed the script to solve linear function and it worked properly.

however, I found myself that checking the result through log is not convenient as much as checking through tree-box.

as for as I know, dispatch function is the right one to make a tree-box to report.

so I changed the script as follows. however, it's not working.

and I want to get the ans for each site (there's 4 sites). so I've tried to do it but it also didn't work.

Could you please give me your hand to solve it

Thank you so much

-> My purpose

1. add ans of each site.

2. add ans to report.

-> My script

Names Default To Here( 1 );

dt = Current Data Table();

// fit quadratic polynomial interpolating function

biv = dt << Bivariate(

Y( :CALU_CALU_intr_cy ),

X( :OC offset Y um ),

Fit Line( {Line Color( {212, 73, 88} )} ),

by(:site),

);

// get reference to report layer

rbiv = biv << Report;

// get parameter estimates

parm = rbiv["Parameter Estimates"][Number Col Box( 1 )] << Get As Matrix;

// compute x intercept

ans = -parm[1] / parm[2];

rbiv<<dispatch(

{"ans"},

"ans",

framebox,

{marker size(3)}

);

Thank you

Highlighted

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

As I have posted many times, the **Send to Report()** and **Dispatch()** arguments are intended for JMP to save customization. They are not intended for users. Of course, you can use them. But there are better ways.

It appears that you want to add the answer to the plot. This example illustrates how to do that.

```
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// fit quadratic polynomial interpolating function
biv = dt << Bivariate(
Y( :weight ),
X( :height ),
Fit Line
);
// get reference to report layer
rbiv = biv << Report;
// get parameter estimates
parm = rbiv["Parameter Estimates"][Number Col Box( 1 )] << Get As Matrix;
// compute x intercept
ans = -parm[1] / parm[2];
rbiv[FrameBox(1)] << Add Graphics Script(
Text( { 52.5, 160 }, "X intercept is " || Char( ans ) )
);
```

Learn it once, use it forever!

Highlighted
##

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

Re: Finding vertex of bivariate graph

It worked

Thank you so much

Thank you so much

Highlighted

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

Created:
Jun 23, 2020 8:23 AM
| Last Modified: Jun 23, 2020 8:24 AM
(1052 views)
| Posted in reply to message from Brad_Park 06-23-2020

Or, another approach is to use Fit Model, use the Response Surface macro so that JMP sets the response surface attribute. Then you will get a response surface output that solves for the critical values.

I had JMP create this script with some data that I made up.

```
Fit Model(
Y( :contrast_100cm ),
Effects( :Offset_Z & RS, :Offset_Z * :Offset_Z ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:contrast_100cm << {Summary of Fit( 0 ), Analysis of Variance( 0 ),
Parameter Estimates( 0 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
),
SendToReport(
Dispatch(
{"Response contrast_100cm", "Whole Model"},
"Summary of Fit",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response contrast_100cm", "Whole Model"},
"Analysis of Variance",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response contrast_100cm", "Whole Model"},
"Parameter Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{"Response contrast_100cm"},
"Response Surface",
OutlineBox,
{Close( 0 )}
)
)
)
```

Here is the part of the output that finds the critical value.

Dan Obermiller

Highlighted
##

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

Re: Finding vertex of bivariate graph

Thank you for reply.

I tested the script and found that this is exactly what I was looking for.

(Even though I didn't understand the whole code )

but I found that the Offset_Z value which is calculated by response surface is slightly different from my manual calculation (by differential)

the difference was under 0.0003 so it was no big deal

Thank you again for your help