Turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Re: Is it possible to display multiple fit lines of different degrees in a singl...

- 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:
May 22, 2020 8:27 AM
| Last Modified: May 22, 2020 8:31 AM
(2020 views)

I would like to display both linear and quadratic fit lines in the same plot. Essentially a combination of the two plots I've attached to this post.

Is this possible in JMP?

Thank you

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

Given your intention, it might be better to look at 'Analyze > Fit Y By X'.

This script:

```
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate(
Y( :height ),
X( :weight ),
GroupBy( :sex ),
FitLine(),
FitPolynomial(2)
)
```

will produce output like this:

and there are lots of additional customizations you could use.

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: Is it possible to display multiple fit lines of different degrees in a single plot?

I don't think you can do this in Graph Builder, but you can in Fit Y by X.

It looks like you may have an overlay variable, just be sure to use the Fit Y by X "Group By" command before fitting the lines and the quadratic polynomials.

Dan Obermiller

Highlighted

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

Given your intention, it might be better to look at 'Analyze > Fit Y By X'.

This script:

```
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate(
Y( :height ),
X( :weight ),
GroupBy( :sex ),
FitLine(),
FitPolynomial(2)
)
```

will produce output like this:

and there are lots of additional customizations you could use.

Highlighted
##

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

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

Excellent, this worked. Thank you.

Highlighted
##

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

Re: Is it possible to display multiple fit lines of different degrees in a single plot?

I agree with @Dan_Obermiller and @ian_jmp but if you really need to use Graph Builder, then the approach is to first fit the models separately and save each one of them as column formula. Then add these columns in the Y drop zone of Graph Builder. Now change the rendering element to Formula.

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: Is it possible to display multiple fit lines of different degrees in a single plot?

Created:
May 23, 2020 12:20 PM
| Last Modified: May 23, 2020 12:21 PM
(1916 views)
| Posted in reply to message from JonathanL 05-22-2020

Hi @JonathanL,

This can be done in Graph Builder, if you would prefer to do it there. If you would like to display a second line element using a different degree, you'll need to add that second element, either by holding the shift key and clicking the line of fit element, or dragging the line of fit element into the graph after you've already selected it. Then, you can change the degree for this second line of fit element. Like every other element, variables in other roles are respected unless disabled, so if you have a variable in the Overlay role, both of these line elements will display lines of fit separately for the levels of the Overlay variable.

Article Labels

There are no labels assigned to this post.