*INTERNAL* How can I create an RMA (reduced major axis) fit curve in a Grapher script?

**NOTE: The math in this script does not work. The slope and intercept values calculated are no where near the values given by the new RMA fit curve type in G14. In addition, the curve is drawn in the wrong direction.
Grapher's fit curves use the least squares fit method. Grapher does not have an automatic way to create the reduced major axis regression equation directly. However, RMA and least squares fit curves are related. There is a script available that does calculate the RMA equation and add it to your existing graph as a function plot. That script is attached to this article.

The downside to this method is that there is not a reported R2 value for the fit. However, some literature says that the R2 value is the same for the RMA fit as it is for the least squares fit method. So, if you create a line/scatter plot and add the Linear fit, the statistics for the linear fit are the same as the statistics for the RMA fit. You can then run the script to add the RMA fit curve to the graph.

To run this script:

  1. Click here to download the BAS file: create RMA fit curve.BAS.
  2. Click Automation | Scripts | Run, select the BAS file from your downloads directory, and click Open.
  3. To get the R2 statistic, click on the line/scatter plot in the Object Manager.
  4. In the Property Manager, click on the Plot tab.
  5. Click the Add/Edit button next to the Fits command.
  6. In the Fits dialog, select Linear, Y=B*X+A.
  7. Click Add.
  8. Click OK.
  9. Click on the Fit 1: Linear fit curve in the Object Manager.
  10. In the Property Manager, click on the Display button next to the Report option. The statistics appear in a report window.
  11. Highlight the Coefficient of determination, R-sq'd value (R2) value in the report.
  12. Click Edit | Copy in the report window.
  13. In the main plot window, click Home | Clipboard | Paste. The value is pasted to the center of the plot window. You can click on the value and move it to the desired location or edit the text.


Updated October 18, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.