Share:
Notifications
Clear all

Linear Regression with Ordinary Least Squares

Page 3 / 4
leegreen
(@leegreen)
1,000+ posts Member

@MathTeacher

Here are a few linear regression reports from InRoads. You are correct, it appears at least one point is on the opposite side of the line or arc, they are all perpendicular or radial. The last report is along an arc.

Notice the InRoads report shows a nice text graph on the right side

using <  |  >  =

 

 

This post was modified 2 months ago by leegreen
ReplyQuote
Posted : December 6, 2021 7:45 am
MathTeacher
(@mathteacher)
1,000+ posts Member

The question of understanding what regression is doing sent me back to my old business statistics textbook from college, ca 1965 or so. The book had formulas for computing the regression coefficients, but being a math major, I was compelled to derive them. There are two necessary conditions: 1) The sum of the calculated y's equals the sum of the original y's, and 2) The sum of the distances from the calculated y's to the original y's is a minimum. There are other assumptions for statistical validity including skedasticity, normalcy, and other stuff that we amateurs routinely ignore.

Anyway, here are the formulas from the textbook:

And here are my written derivation notes:

Finding a minimum is a calculus problem, so there are derivatives involved. As is very often the case, formulating the problem is harder than doing the math.

Hope this helps and thanks again for sharing!

 

ReplyQuote
Posted : December 6, 2021 9:20 am
Bill93
(@bill93)
5,000+ posts Member

ReplyQuote
Posted : December 6, 2021 9:26 am

MathTeacher
(@mathteacher)
1,000+ posts Member

@bill93 pretty well nailed how close everything is. This drawing puts in the two best-fit lines on the west and east sides. Because the east side has only two points, the line goes through both of them. Not so for the west line with its 5 points. The line does not have to go through any of them.

The drawing shows some different approaches to measuring the width. At the top, a line is drawn perpendicular from FB254 to the east line. In the middle, a line perpendicular to the east line is drawn to intersect the west line. Point C is the point of intersection. The bottom example is equivalent to the top one done a slightly different way.

The east and west lines are not parallel, so no measurement between them can be perpendicular to both. All three of the computed measurements are within striking distance of 60 feet. Bill's drawing confirms that and the "relatively" small Carlson adjustments do, too.

At best, the math is a check. How well the truth, that which is on the ground, is a matter of professional judgment. I just cipher, rarely go outside, and am a poor judge of many things, but, depending on how recent the work was done, it doesn't seem too bad to me.

Thanks again, @field-dog for posting this. it's a good concept that provides a great exercise in the intersection of ground and math.

 

ReplyQuote
Posted : December 6, 2021 1:55 pm
Lurker
(@lurker)
200+ posts Member

So Field Dog, out of curiosity, what has been determined by the above results? What is the end conclusion that we are trying to reach?

ReplyQuote
Posted : December 6, 2021 2:06 pm
Field Dog
(@field-dog)
500+ posts Member
Posted by: @mathteacher

The x-coefficient is almost zero which tells us that the regression line is almost horizontal (due east?) which may be what you're looking for.

The line is running N. if you start on pt. 248 (W. side) and go in ascending order.

Posted by: @mathteacher

There's no check on the right-of-way width, though, and having only two points on the east side diminishes the value of two separate regressions.

My boss said he likes to use a best fit line on one side only and check to points on the other side using perpendicular offsets. The plat right-of-way width must rule so we don't take away anyone's frontage. Any minor discrepancies in right-of-way width must favor the property owners.

ReplyQuote
Topic starter Posted : December 6, 2021 6:47 pm

MathTeacher
(@mathteacher)
1,000+ posts Member

@field-dog 

That makes sense and is a great approach from a math viewpoint. The regression line with nearly-zero x-coefficient included all of seven points, those on both sides of the road. I misunderstood the problem. Including points 252 and 253 and points 249 and 250 so nearly in east-west alignment in the regression pretty well guaranteed that result.

All in all, it's just a great problem from several different viewpoints. There's the math, the ground-math connection, communication, interpretation and so on. 

A really good opportunity to think and learn.

ReplyQuote
Posted : December 7, 2021 4:34 am
MathTeacher
(@mathteacher)
1,000+ posts Member

If you'll permit me one last lick at this poor old horse, what Carlson did is regress the Eastings on the Northings. Easting is the dependent variable and Northing is the independent variable. Their offsets are the residuals from the exercise. That makes perfect sense in the context of the problem.

The attached spreadsheet duplicates the Carlson offsets using Excel regression commands. That's still not complete understanding, but Excel can be duplicated by using textbook formulas.

It's good to see consistency among the black boxes.

 

This post was modified 2 months ago by MathTeacher
ReplyQuote
Posted : December 7, 2021 9:43 am
Field Dog
(@field-dog)
500+ posts Member
Posted by: @mathteacher

If you'll permit me one last lick at this poor old horse, what Carlson did is regress the Eastings on the Northings. Easting is the dependent variable and Northing is the independent variable. Their offsets are the residuals from the exercise. That makes perfect sense in the context of the problem.

Thanks for identifying the process! The attached pages might be interesting to you.

ReplyQuote
Topic starter Posted : December 7, 2021 5:55 pm

MathTeacher
(@mathteacher)
1,000+ posts Member

@field-dog 

Indeed. By the way, there's an error in the formula that calculates azimuth in the spreadsheet. it should be:

=Degrees(Atan(E3))

That gives azimuth = 0 .47675 degrees, almost north on the map and it may be north after adjusting for convergence.

There's a cool way to use Excel Solver for regression. Here's the setup for this problem, and it's critical to define tight constraints, but it's educational in that it focuses us on what we're trying to do while Excel chugs through the arithmetic. It also works on curves, as long as an equation can be defined.

Excellent exercise, thanks again.

ReplyQuote
Posted : December 8, 2021 3:46 am
Chris Bouffard
(@chris-bouffard)
200+ posts Member

I'm lost on the reasoning for using the best fit on a ROW, the ROW is the ROW and it is where it is, not where it fits best.

ReplyQuote
Posted : December 9, 2021 1:24 pm
Norman Oklahoma
(@norman-oklahoma)
5,000+ posts Member

@chris-bouffard 

You find 8 pins along a right of way. You run the best fit and find that they all fall no more than 0.04' this way or that of a best fit line. Except 1 that falls 1.00 off. You apply the virtual hammer to 7 and call it a straight line. The eighth is a 1 foot offset. Done in 5 minutes.  Sure, you could reach the same conclusion by fussing with it for a couple hours but why would you want to?

ReplyQuote
Posted : December 9, 2021 2:51 pm
Rover83 liked

Rover83
(@rover83)
500+ posts Member
Posted by: @chris-bouffard

I'm lost on the reasoning for using the best fit on a ROW, the ROW is the ROW and it is where it is, not where it fits best.

I'll ask the same question I asked upthread: would you / do you place angle points at every single monument you find along a ROW that was platted and/or dedicated as a straight line, no matter the positional tolerance or residuals?

ReplyQuote
Posted : December 9, 2021 3:04 pm
Chris Bouffard
(@chris-bouffard)
200+ posts Member

@norman-oklahoma I don't think any of us would have a concern with 0.04, that was not my point.  The ROW became what it is upon dedication and acceptance.  If your example of 0.04 fits are not in accordance with the original intention at the time of conveyance, that "fit" is meaningless and thr ROW is where it is.

I recently came completed a survey next door to the father of somebody that developed the block that the father built his home on.  The father objected to a new home being built on the ajacent lot, even though he did not own it.  He object from the beginning and when the son developed the block, he sought and got approval for a 20 lot subdivision but refused to pay his Surveyor to momument it.

I (my crews) surveyed surveyed the surrounding blocks around the PIQ and determined that pins found on the father's property were somehow shifted by 2', parralell to the road frontage and on my PIQ.  He claimed the new home violated the minimum side yard set back by that 2' and wanted to be compensated.

In come the Legal Eagles.  Fortunately, the Town Engineer and Municipal Attorney were able to understand the proofs laid before them and it was a dine deal with the other Surveyor not even replying to multiple calls and certified mailings to participate in the dispute.

The father's house was on a corner, it had two road frontages, both based on an errant filed plan.  Do we shift one ROW 2', or do we talk about the original intention? 

ReplyQuote
Posted : December 9, 2021 6:47 pm
Chris Bouffard
(@chris-bouffard)
200+ posts Member

@rover83 absolutely not.  The determination would be made on the best available evidence, but, as I have said before, The ROW is where where it is if it were improved in accordance with the original intention, and, sometimes the best fit does not comply with the original intentions.

Are you going to hold the best fit, or, the original intentions?

ReplyQuote
Posted : December 9, 2021 7:03 pm

Page 3 / 4
Share: