Subscribe Bookmark RSS Feed

plot regression line through overlay groups

robert_d_

Community Trekker

Joined:

Feb 27, 2015

Hello,

I want to create an x-y graph with a single regression line passing through data points that are differentiated by color for each of four groups. I can create an overlay plot with different colored groups, see below:8131_JMP-Overlay.PNG

But can't do regression in Overlay mode. This is pretty simple to do in Proc Gplot so I figure there's a way in JMP.

Any pointers?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

You can use Graph Builder to do this.  Plot meanHI vs population, and drag the Density column into the Color area.  Then click on the Line of Fit toolbar icon.

Here's a scripted example using Big Class:

dt = open("$sample_data\Big Class.jmp");

dt << Graph Builder(

     Show Control Panel( 0 ),

     Variables( X( :weight ), Y( :height ), Color( :age ) ),

     Elements(

           Points( X, Y, Legend( 1 ), Jitter( 1 ) ),

           Line Of Fit(

                X,

                Y,

                Legend( 4 ),

                Confidence of Fit( 0 ),

                Confidence of Prediction( 0 ),

                Degree( "Linear" ),

                Equation( 0 ),

                Root Mean Square Error( 0 ),

                R²( 0 )

           )

     )

);


8140_Big Class Regression.png

2 REPLIES
Solution

You can use Graph Builder to do this.  Plot meanHI vs population, and drag the Density column into the Color area.  Then click on the Line of Fit toolbar icon.

Here's a scripted example using Big Class:

dt = open("$sample_data\Big Class.jmp");

dt << Graph Builder(

     Show Control Panel( 0 ),

     Variables( X( :weight ), Y( :height ), Color( :age ) ),

     Elements(

           Points( X, Y, Legend( 1 ), Jitter( 1 ) ),

           Line Of Fit(

                X,

                Y,

                Legend( 4 ),

                Confidence of Fit( 0 ),

                Confidence of Prediction( 0 ),

                Degree( "Linear" ),

                Equation( 0 ),

                Root Mean Square Error( 0 ),

                R²( 0 )

           )

     )

);


8140_Big Class Regression.png

robert_d_

Community Trekker

Joined:

Feb 27, 2015

That worked. Thank you for the speedy reply and the scripting example.