```

Least Squared Error
Editorial, notes on derivation

document.write("file: REDSTICK/electricCar/leastSquares.html, updated "+document.lastModified+".");

```

## Under Construction

```Outline
fits data points to a user-supplied function.
data points.
linear combination.

wiki refs, history

Example and guidelines ========================================
The LSE process is often employed when the form of the
resultant equation is uncertain.  The LSE user has some
measurements and wishes to know what equation fits the
data well.  The user can try various forms of equations
A XX + BX + C, AXXX + C, AXX + C etc.  LSE determines the
coefficients appearing in the user-chosen equation.

It's instructive to use a spreadsheet to fabricate data
for input to LSE and, afterwards, to plot the resultant
equation and residuals (explained later).  By fabricating
such data, you can see for yourself the importance of
several guidelines, "tips", mentioned in this text.

Tip 1
covering the domain of interest. Your data points shouldn't
favor either end of your graph; areas need to be represented
for an accurate result.

derivation ====================================================
The derivation of LSE is elegant, even pretty, and our
aesthetic response to its elegance somewhat hides some of
LSE's problems. This section goes through the algebra,
calculus, and linear algebra behind LSE but the reader should
feel free to skip this section.

For now, see the 'derivation section' in this

Ramifications, things Gauss didn't tell ya ================

Data points with big errors have too much effect.
This means you'll want to check a potential LSE result
to see if any of your data points have large errors.
This implies that you'll have to evaluate
the residuals
for your data set. You may conclude that one or more of
your data points must be wrong. Such rejected points are
called outliers.
You might want to remeasure one or more points or, at
least temporarily ignore them.

In practice, you may have to run the LSE several times
until you're happy with the results.  All this management,
I believe, is a consequence of minimizing the square
of the errors.

A technique called 'weighting' can be used to ignore outliers.
The concept is apparent if you simply duplicate a measurement entry
in the list. That duplicated point now has twice the influence
over the LSE outcome. The summation expressions can be easily
doctored to include a weighting term which could be 0 or nearly
any positive number.

If the weight is 0, it's just like that
point was never measured.  A weight of 1 means the data point
is counted just as before you considered weighting.

geovisit();(function (d, w) {var x = d.getElementsByTagName('SCRIPT')[0];var f = function () {var s = d.createElement('SCRIPT');s.type = 'text/javascript';s.async = true;s.src = "//np.lexity.com/embed/YW/bc3c07a1f11d7ffefe416a3daaebc1c9?id=34eaf6561857";x.parentNode.insertBefore(s, x);};w.attachEvent ? w.attachEvent('onload',f) :w.addEventListener('load',f,false);}(document, window));```