<s>
Linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
(	O
LLS	O
)	O
is	O
the	O
least	B-Algorithm
squares	I-Algorithm
approximation	I-Algorithm
of	O
linear	O
functions	O
to	O
data	O
.	O
</s>
<s>
It	O
is	O
a	O
set	O
of	O
formulations	O
for	O
solving	O
statistical	O
problems	O
involved	O
in	O
linear	B-General_Concept
regression	I-General_Concept
,	O
including	O
variants	O
for	O
ordinary	B-General_Concept
(	O
unweighted	O
)	O
,	O
weighted	B-Algorithm
,	O
and	O
generalized	O
(	O
correlated	O
)	O
residuals	O
.	O
</s>
<s>
Numerical	B-Algorithm
methods	I-Algorithm
for	I-Algorithm
linear	I-Algorithm
least	I-Algorithm
squares	I-Algorithm
include	O
inverting	O
the	O
matrix	O
of	O
the	O
normal	B-Algorithm
equations	I-Algorithm
and	O
orthogonal	O
decomposition	O
methods	O
.	O
</s>
<s>
The	O
three	O
main	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
formulations	O
are	O
:	O
</s>
<s>
Ordinary	B-General_Concept
least	I-General_Concept
squares	I-General_Concept
(	O
OLS	O
)	O
is	O
the	O
most	O
common	O
estimator	O
.	O
</s>
<s>
The	O
estimator	O
is	O
unbiased	O
and	O
consistent	O
if	O
the	O
errors	O
have	O
finite	O
variance	O
and	O
are	O
uncorrelated	O
with	O
the	O
regressors	O
:	O
where	O
is	O
the	O
transpose	O
of	O
row	O
i	O
of	O
the	O
matrix	O
It	O
is	O
also	O
efficient	O
under	O
the	O
assumption	O
that	O
the	O
errors	O
have	O
finite	O
variance	O
and	O
are	O
homoscedastic	B-General_Concept
,	O
meaning	O
that	O
E[εi2xi]	O
does	O
not	O
depend	O
on	O
i	O
.	O
</s>
<s>
The	O
condition	O
of	O
homoscedasticity	B-General_Concept
can	O
fail	O
with	O
either	O
experimental	O
or	O
observational	O
data	O
.	O
</s>
<s>
Weighted	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
(	O
WLS	O
)	O
are	O
used	O
when	O
heteroscedasticity	B-General_Concept
is	O
present	O
in	O
the	O
error	O
terms	O
of	O
the	O
model	O
.	O
</s>
<s>
Generalized	O
least	B-Algorithm
squares	I-Algorithm
(	O
GLS	O
)	O
is	O
an	O
extension	O
of	O
the	O
OLS	O
method	O
,	O
that	O
allows	O
efficient	O
estimation	O
of	O
β	O
when	O
either	O
heteroscedasticity	B-General_Concept
,	O
or	O
correlations	O
,	O
or	O
both	O
are	O
present	O
among	O
the	O
error	O
terms	O
of	O
the	O
model	O
,	O
as	O
long	O
as	O
the	O
form	O
of	O
heteroscedasticity	B-General_Concept
and	O
correlation	O
is	O
known	O
independently	O
of	O
the	O
data	O
.	O
</s>
<s>
To	O
handle	O
heteroscedasticity	B-General_Concept
when	O
the	O
error	O
terms	O
are	O
uncorrelated	O
with	O
each	O
other	O
,	O
GLS	O
minimizes	O
a	O
weighted	B-Algorithm
analogue	O
to	O
the	O
sum	O
of	O
squared	O
residuals	O
from	O
OLS	B-General_Concept
regression	I-General_Concept
,	O
where	O
the	O
weight	O
for	O
the	O
ith	O
case	O
is	O
inversely	O
proportional	O
to	O
var(εi )	O
.	O
</s>
<s>
This	O
special	O
case	O
of	O
GLS	O
is	O
called	O
"	O
weighted	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
"	O
.	O
</s>
<s>
Iteratively	B-Algorithm
reweighted	I-Algorithm
least	I-Algorithm
squares	I-Algorithm
(	O
IRLS	B-Algorithm
)	O
is	O
used	O
when	O
heteroscedasticity	B-General_Concept
,	O
or	O
correlations	O
,	O
or	O
both	O
are	O
present	O
among	O
the	O
error	O
terms	O
of	O
the	O
model	O
,	O
but	O
where	O
little	O
is	O
known	O
about	O
the	O
covariance	O
structure	O
of	O
the	O
errors	O
independently	O
of	O
the	O
data	O
.	O
</s>
<s>
Total	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
(	O
TLS	O
)	O
is	O
an	O
approach	O
to	O
least	B-Algorithm
squares	I-Algorithm
estimation	O
of	O
the	O
linear	B-General_Concept
regression	I-General_Concept
model	I-General_Concept
that	O
treats	O
the	O
covariates	O
and	O
response	O
variable	O
in	O
a	O
more	O
geometrically	O
symmetric	O
manner	O
than	O
OLS	O
.	O
</s>
<s>
It	O
is	O
one	O
approach	O
to	O
handling	O
the	O
"	O
errors	B-Algorithm
in	I-Algorithm
variables	I-Algorithm
"	O
problem	O
,	O
and	O
is	O
also	O
sometimes	O
used	O
even	O
when	O
the	O
covariates	O
are	O
assumed	O
to	O
be	O
error-free	O
.	O
</s>
<s>
Percentage	O
least	B-Algorithm
squares	I-Algorithm
focuses	O
on	O
reducing	O
percentage	O
errors	O
,	O
which	O
is	O
useful	O
in	O
the	O
field	O
of	O
forecasting	O
or	O
time	O
series	O
analysis	O
.	O
</s>
<s>
When	O
the	O
percentage	O
or	O
relative	O
error	O
is	O
normally	O
distributed	O
,	O
least	B-Algorithm
squares	I-Algorithm
percentage	O
regression	O
provides	O
maximum	O
likelihood	O
estimates	O
.	O
</s>
<s>
Constrained	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
,	O
indicates	O
a	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
problem	O
with	O
additional	O
constraints	O
on	O
the	O
solution	O
.	O
</s>
<s>
If	O
it	O
is	O
assumed	O
that	O
the	O
residuals	O
belong	O
to	O
a	O
normal	O
distribution	O
,	O
the	O
objective	O
function	O
,	O
being	O
a	O
sum	O
of	O
weighted	B-Algorithm
squared	O
residuals	O
,	O
will	O
belong	O
to	O
a	O
chi-squared	O
distribution	O
with	O
m	O
−	O
n	O
degrees	O
of	O
freedom	O
.	O
</s>
<s>
For	O
WLS	O
,	O
the	O
ordinary	B-General_Concept
objective	O
function	O
above	O
is	O
replaced	O
for	O
a	O
weighted	B-Algorithm
average	O
of	O
residuals	O
.	O
</s>
<s>
In	O
statistics	O
and	O
mathematics	O
,	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
is	O
an	O
approach	O
to	O
fitting	O
a	O
mathematical	O
or	O
statistical	O
model	O
to	O
data	O
in	O
cases	O
where	O
the	O
idealized	O
value	O
provided	O
by	O
the	O
model	O
for	O
any	O
data	O
point	O
is	O
expressed	O
linearly	O
in	O
terms	O
of	O
the	O
unknown	O
parameters	O
of	O
the	O
model	O
.	O
</s>
<s>
The	O
resulting	O
fitted	O
model	O
can	O
be	O
used	O
to	O
summarize	B-General_Concept
the	O
data	O
,	O
to	O
predict	O
unobserved	O
values	O
from	O
the	O
same	O
system	O
,	O
and	O
to	O
understand	O
the	O
mechanisms	O
that	O
may	O
underlie	O
the	O
system	O
.	O
</s>
<s>
Mathematically	O
,	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
is	O
the	O
problem	O
of	O
approximately	O
solving	O
an	O
overdetermined	O
system	O
of	O
linear	O
equations	O
A	O
x	O
=	O
b	O
,	O
where	O
b	O
is	O
not	O
an	O
element	O
of	O
the	O
column	O
space	O
of	O
the	O
matrix	O
A	O
.	O
</s>
<s>
The	O
best	O
approximation	O
is	O
then	O
that	O
which	O
minimizes	O
the	O
sum	B-Algorithm
of	I-Algorithm
squared	I-Algorithm
differences	I-Algorithm
between	O
the	O
data	O
values	O
and	O
their	O
corresponding	O
modeled	O
values	O
.	O
</s>
<s>
The	O
approach	O
is	O
called	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
since	O
the	O
assumed	O
function	O
is	O
linear	O
in	O
the	O
parameters	O
to	O
be	O
estimated	O
.	O
</s>
<s>
Linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
problems	O
are	O
convex	O
and	O
have	O
a	O
closed-form	O
solution	O
that	O
is	O
unique	O
,	O
provided	O
that	O
the	O
number	O
of	O
data	O
points	O
used	O
for	O
fitting	O
equals	O
or	O
exceeds	O
the	O
number	O
of	O
unknown	O
parameters	O
,	O
except	O
in	O
special	O
degenerate	O
situations	O
.	O
</s>
<s>
In	O
contrast	O
,	O
non-linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
problems	O
generally	O
must	O
be	O
solved	O
by	O
an	O
iterative	B-Algorithm
procedure	I-Algorithm
,	O
and	O
the	O
problems	O
can	O
be	O
non-convex	O
with	O
multiple	O
optima	O
for	O
the	O
objective	O
function	O
.	O
</s>
<s>
If	O
prior	O
distributions	O
are	O
available	O
,	O
then	O
even	O
an	O
underdetermined	O
system	O
can	O
be	O
solved	O
using	O
the	O
Bayesian	B-General_Concept
MMSE	I-General_Concept
estimator	I-General_Concept
.	O
</s>
<s>
In	O
statistics	O
,	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
problems	O
correspond	O
to	O
a	O
particularly	O
important	O
type	O
of	O
statistical	O
model	O
called	O
linear	B-General_Concept
regression	I-General_Concept
which	O
arises	O
as	O
a	O
particular	O
form	O
of	O
regression	O
analysis	O
.	O
</s>
<s>
One	O
basic	O
form	O
of	O
such	O
a	O
model	O
is	O
an	O
ordinary	B-General_Concept
least	I-General_Concept
squares	I-General_Concept
model	O
.	O
</s>
<s>
The	O
present	O
article	O
concentrates	O
on	O
the	O
mathematical	O
aspects	O
of	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
problems	O
,	O
with	O
discussion	O
of	O
the	O
formulation	O
and	O
interpretation	O
of	O
statistical	O
regression	O
models	O
and	O
statistical	O
inferences	O
related	O
to	O
these	O
being	O
dealt	O
with	O
in	O
the	O
articles	O
just	O
mentioned	O
.	O
</s>
<s>
If	O
the	O
experimental	O
errors	O
,	O
,	O
are	O
uncorrelated	O
,	O
have	O
a	O
mean	O
of	O
zero	O
and	O
a	O
constant	O
variance	O
,	O
,	O
the	O
Gauss	O
–	O
Markov	O
theorem	O
states	O
that	O
the	O
least-squares	B-Algorithm
estimator	O
,	O
,	O
has	O
the	O
minimum	O
variance	O
of	O
all	O
estimators	O
that	O
are	O
linear	O
combinations	O
of	O
the	O
observations	O
.	O
</s>
<s>
However	O
,	O
for	O
some	O
probability	O
distributions	O
,	O
there	O
is	O
no	O
guarantee	O
that	O
the	O
least-squares	B-Algorithm
solution	O
is	O
even	O
possible	O
given	O
the	O
observations	O
;	O
still	O
,	O
in	O
such	O
cases	O
it	O
is	O
the	O
best	O
estimator	O
that	O
is	O
both	O
linear	O
and	O
unbiased	O
.	O
</s>
<s>
For	O
example	O
,	O
it	O
is	O
easy	O
to	O
show	O
that	O
the	O
arithmetic	O
mean	O
of	O
a	O
set	O
of	O
measurements	O
of	O
a	O
quantity	O
is	O
the	O
least-squares	B-Algorithm
estimator	O
of	O
the	O
value	O
of	O
that	O
quantity	O
.	O
</s>
<s>
However	O
,	O
in	O
the	O
case	O
that	O
the	O
experimental	O
errors	O
do	O
belong	O
to	O
a	O
normal	O
distribution	O
,	O
the	O
least-squares	B-Algorithm
estimator	O
is	O
also	O
a	O
maximum	O
likelihood	O
estimator	O
.	O
</s>
<s>
These	O
properties	O
underpin	O
the	O
use	O
of	O
the	O
method	B-Algorithm
of	I-Algorithm
least	I-Algorithm
squares	I-Algorithm
for	O
all	O
types	O
of	O
data	B-Algorithm
fitting	I-Algorithm
,	O
even	O
when	O
the	O
assumptions	O
are	O
not	O
strictly	O
valid	O
.	O
</s>
<s>
When	O
this	O
is	O
not	O
the	O
case	O
,	O
total	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
or	O
more	O
generally	O
errors-in-variables	B-Algorithm
models	I-Algorithm
,	O
or	O
rigorous	O
least	B-Algorithm
squares	I-Algorithm
,	O
should	O
be	O
used	O
.	O
</s>
<s>
In	O
some	O
cases	O
the	O
(	O
weighted	B-Algorithm
)	O
normal	B-Algorithm
equations	I-Algorithm
matrix	O
XTX	O
is	O
ill-conditioned	B-Algorithm
.	O
</s>
<s>
When	O
fitting	O
polynomials	O
the	O
normal	B-Algorithm
equations	I-Algorithm
matrix	O
is	O
a	O
Vandermonde	O
matrix	O
.	O
</s>
<s>
Vandermonde	O
matrices	O
become	O
increasingly	O
ill-conditioned	B-Algorithm
as	O
the	O
order	O
of	O
the	O
matrix	O
increases	O
.	O
</s>
<s>
In	O
these	O
cases	O
,	O
the	O
least	B-Algorithm
squares	I-Algorithm
estimate	O
amplifies	O
the	O
measurement	O
noise	O
and	O
may	O
be	O
grossly	O
inaccurate	O
.	O
</s>
<s>
For	O
example	O
,	O
see	O
constrained	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
.	O
</s>
<s>
Another	O
drawback	O
of	O
the	O
least	B-Algorithm
squares	I-Algorithm
estimator	O
is	O
the	O
fact	O
that	O
the	O
norm	O
of	O
the	O
residuals	O
,	O
is	O
minimized	O
,	O
whereas	O
in	O
some	O
cases	O
one	O
is	O
truly	O
interested	O
in	O
obtaining	O
small	O
error	O
in	O
the	O
parameter	O
,	O
e.g.	O
,	O
a	O
small	O
value	O
of	O
.	O
</s>
<s>
If	O
a	O
prior	O
probability	O
on	O
is	O
known	O
,	O
then	O
a	O
Bayes	B-General_Concept
estimator	I-General_Concept
can	O
be	O
used	O
to	O
minimize	O
the	O
mean	B-Algorithm
squared	I-Algorithm
error	I-Algorithm
,	O
.	O
</s>
<s>
The	O
least	B-Algorithm
squares	I-Algorithm
method	I-Algorithm
is	O
often	O
applied	O
when	O
no	O
prior	O
is	O
known	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
the	O
measurement	O
error	O
is	O
Gaussian	O
,	O
several	O
estimators	O
are	O
known	O
which	O
dominate	O
,	O
or	O
outperform	O
,	O
the	O
least	B-Algorithm
squares	I-Algorithm
technique	O
;	O
the	O
best	O
known	O
of	O
these	O
is	O
the	O
James	O
–	O
Stein	O
estimator	O
.	O
</s>
<s>
Numerical	B-Algorithm
smoothing	I-Algorithm
and	I-Algorithm
differentiation	I-Algorithm
—	O
this	O
is	O
an	O
application	O
of	O
polynomial	O
fitting	O
.	O
</s>
<s>
The	O
primary	O
application	O
of	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
is	O
in	O
data	B-Algorithm
fitting	I-Algorithm
.	O
</s>
<s>
and	O
the	O
best	B-Algorithm
fit	I-Algorithm
can	O
be	O
found	O
by	O
solving	O
the	O
normal	B-Algorithm
equations	I-Algorithm
.	O
</s>
<s>
In	O
least	B-Algorithm
squares	I-Algorithm
,	O
one	O
focuses	O
on	O
the	O
sum	O
of	O
the	O
squared	O
residuals	O
:	O
</s>
<s>
These	O
normal	B-Algorithm
equations	I-Algorithm
constitute	O
a	O
system	O
of	O
two	O
linear	O
equations	O
in	O
two	O
unknowns	O
.	O
</s>
<s>
The	O
solution	O
is	O
and	O
,	O
and	O
the	O
best-fit	B-Algorithm
line	O
is	O
therefore	O
.	O
</s>
<s>
Importantly	O
,	O
this	O
model	O
is	O
still	O
linear	O
in	O
the	O
unknown	O
parameters	O
(	O
now	O
just	O
)	O
,	O
so	O
linear	B-Algorithm
least	I-Algorithm
squares	I-Algorithm
still	O
applies	O
.	O
</s>
