Subscribe Bookmark RSS Feed

Plotting Multiple linear regression line on one graph

achengula

New Contributor

Joined:

May 16, 2017

Hi There!

I have 10 Y measurements all against one X, how do I compare the responses on one graph using the linear regression lines (on the scatterplots)? The Y are in triplicates.  I have attached the Excel file with the data.

2 ACCEPTED SOLUTIONS

Accepted Solutions
markbailey

Staff

Joined:

Jun 23, 2011

Solution

There are three ways that you use to 'compare' the 10 regressions. You need to stack the ten Y columns first for all ten of them to work.(Select Tables > Stack) Try these methods with the stacked data table:

  • Bivariate: Select Analyze > Fit Y by X. Enter the column of stacked measurements in Y role and predictor in X role. Click OK. Click the red triangle at the top of Bivariate and select Group by. Select the label column to identify the groups and click OK. Now click the red triangle again and select Fit Line.
  • Fit Least Squares: Select Analyze > Fit Model. Enter the column of stacked measurements in Y role. Select the predictor X column and the label column. Click Macros and select Full Factorial. Click Run.
  • Graph Builder: Select Graph > Graph Builder. Drag column of stacked measurements to Y drop zone and the predictor X column to the X zone. Drag the label column to the Overlay zone. Remove the smooth element and add the regression element (use element buttons above the canvas or right-click the canvas and use menu commands).
Learn it once, use it forever!
markbailey

Staff

Joined:

Jun 23, 2011

Solution
  1. 1. Select File > Preferences > Fonts.
  2. It depends on your method.
    1. Bivariate: the equation for each group is provided in separate reports below the plot.
      1. See Help > Books > Basic Analysis > chapter 5.
    2. Fit Least Squares: this model is more complex so there isn't a separate equation for each group. Instead, there are separate parameters for each group. It should be clear from the Parameter Estimates report but you can also see it in the column formula is you click the red triangle next to Response and select Save Columns > Prediction Formula.
      1. See Help > Books > Fitting Linear Models > chapter 3.
    3. Graph Builder: the equations for the linear trend lines are available in the properties on the left side below the list of columns.
      1. See Help > Books > Essential Graphing > Line of Fit in chapter 3.
Learn it once, use it forever!
3 REPLIES
markbailey

Staff

Joined:

Jun 23, 2011

Solution

There are three ways that you use to 'compare' the 10 regressions. You need to stack the ten Y columns first for all ten of them to work.(Select Tables > Stack) Try these methods with the stacked data table:

  • Bivariate: Select Analyze > Fit Y by X. Enter the column of stacked measurements in Y role and predictor in X role. Click OK. Click the red triangle at the top of Bivariate and select Group by. Select the label column to identify the groups and click OK. Now click the red triangle again and select Fit Line.
  • Fit Least Squares: Select Analyze > Fit Model. Enter the column of stacked measurements in Y role. Select the predictor X column and the label column. Click Macros and select Full Factorial. Click Run.
  • Graph Builder: Select Graph > Graph Builder. Drag column of stacked measurements to Y drop zone and the predictor X column to the X zone. Drag the label column to the Overlay zone. Remove the smooth element and add the regression element (use element buttons above the canvas or right-click the canvas and use menu commands).
Learn it once, use it forever!
achengula

New Contributor

Joined:

May 16, 2017

Thank you very much both methods have worked very well. I have two more questions,

1. How do I format the Y and X axis titles, I have been able to change the naming but not able to bold or increase the font size. Formaing the Y and X axis scale I have managed.

2. Is it possible to obtain the Equation of each of the line fitted in the model? How do I do that?

markbailey

Staff

Joined:

Jun 23, 2011

Solution
  1. 1. Select File > Preferences > Fonts.
  2. It depends on your method.
    1. Bivariate: the equation for each group is provided in separate reports below the plot.
      1. See Help > Books > Basic Analysis > chapter 5.
    2. Fit Least Squares: this model is more complex so there isn't a separate equation for each group. Instead, there are separate parameters for each group. It should be clear from the Parameter Estimates report but you can also see it in the column formula is you click the red triangle next to Response and select Save Columns > Prediction Formula.
      1. See Help > Books > Fitting Linear Models > chapter 3.
    3. Graph Builder: the equations for the linear trend lines are available in the properties on the left side below the list of columns.
      1. See Help > Books > Essential Graphing > Line of Fit in chapter 3.
Learn it once, use it forever!