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

- JMP User Community
- :
- Discussions
- :
- Adding a regression line with known slope in Graph Builder

- 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 6, 2017 1:45 PM
| Last Modified: Feb 13, 2018 12:29 PM
(10419 views)

Hi All,

I like to use Graph builder for X-Y correlation charts instead of using Bivariate. Does someone knows weather in graph builder we can do a regression line or fit line with known slope? can user define the slope of fit? i want to use graph builder since i want to have multiple charts separated in GX and GY groupes.

Thank you very much for your inputs.

Ram

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

Hi @ram,

Yes, you can do this with a custom graphics script. In graph builder, or any graph for that matter, right click > customize. Then, click the plus sign to add a new graphics script. There is a template for a y function that will work for you, and you can customize/change the slope (or anything else you like) about the y function. Below is a brief video showing that. Is this what you were looking for?

I hope this helps!

Julian

6 REPLIES 6

Highlighted
##

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

Re: JMP Graph Builder regression line with known slope (slope user defined)

Line of Fit is one of the items that can be placed onto a Graph Builder graph

Jim

Highlighted
##

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

Re: JMP Graph Builder regression line with known slope (slope user defined)

How can i adjust slope or how i can change the slope of fit line.

Highlighted
##

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

Re: JMP Graph Builder regression line with known slope (slope user defined)

Created:
Jun 6, 2017 5:13 PM
| Last Modified: Jun 6, 2017 5:53 PM
(10404 views)
| Posted in reply to message from ram 06-06-2017

While there is nothing as straight forward as in the Bivariate graph, for adding functions, you can use the Customize capability in Graph Builder, and get any kind of function displayed you desire

Here is a very simple linear equasion added to Graph Builder using the following addition to the Customize ability

```
Pen Color( "red" );
Pen Size( 3 );
intercept = 50;
beta = .2;
Y Function( intercept + beta * x, x );
```

Jim

Highlighted

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

Hi @ram,

Yes, you can do this with a custom graphics script. In graph builder, or any graph for that matter, right click > customize. Then, click the plus sign to add a new graphics script. There is a template for a y function that will work for you, and you can customize/change the slope (or anything else you like) about the y function. Below is a brief video showing that. Is this what you were looking for?

I hope this helps!

Julian

Highlighted
##

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

Re: JMP Graph Builder regression line with known slope (slope user defined)

How about the situation where I know only the intercept but not the slope?

Highlighted
##

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

Re: JMP Graph Builder regression line with known slope (slope user defined)

Created:
Apr 29, 2019 2:24 AM
| Last Modified: Apr 29, 2019 2:25 AM
(7016 views)
| Posted in reply to message from Core 04-26-2019

You could use 'Fit Special' in 'Fit Y By X', then the approach of @txnelson:

```
NamesDefaultToHere(1);
// Example data
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Plot data
biv = dt << Bivariate(Y( :height ), X( :weight ), Invisible);
// Fit Special
myIntercept = 0;
biv << Fit Special( Intercept( myIntercept ));
// Save formula to table
biv << (Curve[1] << savePredicteds);
// Close Bivariate
Report(biv) << closeWindow;
// Get the formula
form = Column(dt, "Predicted Height") << getFormula;
// Express the formula as a function of x so 'YFunction()' will work
SubstituteInto(form, Expr(:weight), Expr(x));
// Use Graph Builder
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ) )
);
// Add the graphics script
gbRep = Report(gb);
addScript = Expr(gbRep[FrameBox(1)] << addGraphicsScript(PenColor("Red"); YFunction(formTBD, x)));
SubstituteInto(addScript, Expr(formTBD), NameExpr(form));
addScript;
```

Article Labels

There are no labels assigned to this post.