Alfa 156: Receipts, Mileage, and Linear Regression

I usually send my Alfa 156 for service or repair at either Tan Motors in Ipoh, or Emech in USJ. Tan Motors gives me a usual receipt with the date on it, but Emech takes the extra effort to record the car mileage on the receipt as well.

(Actually, Emech goes a bit overboard and puts stickers all over the car to indicate what was changed, when it was changed, and what it was changed with).

It’s often more useful to know when certain wear and tear items were changed in terms of mileage rather than dates. Since i don’t have that information for my Tan Motors receipts, I figured it would be useful to derive those values.

First stop was to figure out what was the word I wanted … you know where you plot the known points on a graph, and then draw a line that is as about equally close to as many of the lines as possible? From that line, you can then read off points on one axis and get the corresponding value on the other axis. We did it in mathematics in secondary school.

Linear Regression? Well, I found a lot of useful info at this page:

That seemed about right. I also found out I didn’t need to actually bring out the graph paper — you can do it directly with built-in functions in a spreadsheet. And even a Google Docs one at that!

I started by creating a new google docs spreadsheet that recorded the known mileages and dates from my Emech receipts:

I then appended the following to the end:

Look carefully at the formula in C12 … it says “=TREND(C3:C9, B3:B9, B12)”. C3:C9 is the original data “actual mileage” values, and B3:B9 are the set of dates that match the mileage. B12 is the cell immediately to the left of it.

Now if you key in a date into B12, the spreadsheet will estimate what the mileage is/was at that given date!

For 6-jun-2009, my mileage would be roughly 87,761 miles (yeah, my Alfa 156 is a UK spec and everything is in miles).

You can change the date in B12 to anything you like, and play “what-if”. For example, on my birthday this year, my mileage was around 95,923 miles.

You can even do silly things like what was the mileage when I was born (-317,511 miles), or what it will be in the future (in 10 years time, my mileage would be 208,851 miles).

If you reverse the first two parameters in the formula, you can use it to ask “on what date will my mileage be so-and-so?”.

The prediction is as good as your original data that you feed into it, and of course is just an estimate. The more data you feed it, the more accurate it becomes. And of course, it assumes you drive a constant distance every single day — which may not be the case in real life, but works out to be pretty accurate over a long period of time.

Now that we know how to easily do this, what other every day situations can you think of that Linear Regression would be useful for?

This post was originally published as a Facebook Note at 2010-07-23 01:06:48 +0800.

You may also like...