Best Fit Line by Least Squares

This command will process a group of points to compute the best fitting line by least squares. The points can be selected by screen selection, point number, point group name or polyline vertices. The program can calculate either a 2D or 3D line. There are options to best fit with nothing held (None), to best fit by holding a point, and to best fit by holding a bearing. All three options are shown below in the graphic. When holding a point, you are prompted to enter the weight for the point. In this example, a weight of 1000 caused the line to pass to within 0.025 of point 111. With a weight of 5000, the line passed to within 0.005 of point 111. Increase the weight accordingly to obtain the desired precision. When holding a bearing such as N45E, you are prompted to enter the bearing in the form QDD.MMSS (e.g. 145.0000 or just 145). The program generates a standard report. The residual for each point is the perpendicular distance from the point to the best-fit line.

After specifying the points, the program calculates the best-fit line and shows the results in the dialog show here. You can toggle each point for whether to include in the calculations. Points with Process set to No and not used for calculating the line but are still included in the report of residuals. Use the Remove button to remove a point both from calculation and reporting.

The Create Two Parallel Lines option applies when the points are for two line that are meant to be parallel such as a right-of-way. The program takes input for the distance between these two lines and then automatically sorts the points between the two lines, reports the residuals for the two lines and draws the two lines.

Prompts

Select points from screen, group or by point number [<Screen>/Group/Number/Polyline]? S>
Create 2D or 3D line [<2d>/3d]? 2d
Select Carlson Software Points.
Select objects: pick the five points
Point numbers (Enter to continue): press Enter
Parameter to hold [<None>/Point/Bearing]: P
Enter point number to hold:111
Enter weight for point: 5000

Sample Report:

Best Fit Line By Least Squares
Holding point 111: (5227.721,5149.482)
Coordinate File> c:\data\interval.crd
Source Coordinates
Point# Northing Easting Residual
109 5103.542 5182.098 10.050
110 5114.634 5191.928 6.921
111 5149.482 5227.721 0.005
112 5178.703 5268.237 0.400
113 5201.666 5312.602 8.129
Residuals Standard Deviation: 6.559

Bearing: N 53°44'07" E
Distance: 163.266

Pulldown Menu Location: COGO
Keyboard Command: bfitlinelq
Prerequisite: Group of points to sample