To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example is designed to explain the differences in the residue output values of the Linear Fit VI whenever the method used is changed between the "Least Square", "Least Absolute Residual", and "Bisquare" methods.
Description
When using the Linear Fit VI, you can select between the aforementioned methods to change how the line-of-best-fit is calculated. Alongside this, the method for which the residual error is calculated is also changed. When using another program to calculate the best fit line, such as Excel, you will also obtain residue values. However, it may not always be clear how these values compare to the values obtained in LabVIEW if you aren't sure the method used.
Below is the Context Help description for the residues output of the Linear Fit VI.
The description mentions that the residue is calculated by either the "mean absolute error" or the "mean square error". The equations for both are shown below:
The example VI below shows manual calculations that demonstrate when each type of residue equation is used.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.