which simplifies to
[
n
∑n
∑n i=1 xi
i=1 xi
∑n
i=1 x
(^2) i
][
β 0
β 1
]
[ ∑n
∑ni=1 yi
i=1 xiyi
]
(11 .92)
which is the matrix form of the equations (11.90). This presents an alternative way
to solve for the coefficients β 0 and β 1
Linear Regression
The previous least squares method applied to a straight line fit of data. The ideas
presented can be generalized to fitting data to any linear combination of functions.
Given a set of data points (xi, yi), for i= 1, 2 ,.. ., n , assume a curve fit function of the
form
y=y(x) = β 0 f 0 (x) + β 1 f 1 (x) + β 2 f 2 (x) + ···+βkfk(x) (11 .93)
where β 0 , β 1 ,... , β kare unknown coefficients and f 0 (x), f 1 (x), f 2 (x),... , fk(x) represent
linearly independent functions, called the basis of the representation. Note that for
the previous straight line fit the independent functions f 0 (x) = 1 and f 1 (x) = xwere
used. In general, select any set of independent functions and select the βcoefficients
such that the sum of squares error
E=E(β 0 , β 1 ,... , β k) =
∑n
i=1
(y(xi)−yi)^2
E=E(β 0 , β 1 ,... , β k) =
∑n
i=1
[β 0 f 0 (xi) + β 1 f 1 (xi) + β 2 f 2 (xi) + ···+βkfk(xi)−yi]^2
(11 .94)
is a minimum. The determination of the β-values requires a solution be found from
the set of simultaneous least square equations
∂E
∂β 0 = 0,
∂E
∂β 1 = 0, ···,
∂E
∂β k= 0. (11 .95)
Another way to obtain the system of equations (11.95) is to first represent the data
in the matrix form Aβ=y
f 0 (x 1 ) f 1 (x 1 ) f 2 (x 1 ) ··· fk(x 1 )
f 0 (x 2 ) f 1 (x 2 ) f 2 (x 2 ) ··· fk(x 2 )
..
.
..
.
..
.
... ..
.
f 0 (xn) f 1 (xn) f 2 (xn) ··· fk(xn)
β 0
β 1
β 2
..
.
βk
=
y 1
y 2
..
.
yn
(11 .96)