Graphics Programs Reference
In-Depth Information
n
∂
S
W
2
i
b
=−
2
(
y
i
−
a
−
bx
i
)
x
i
=
0
∂
i
=
1
or
n
n
n
W
2
i
W
i
x
i
=
W
i
y
i
+
a
b
(3.26a)
i
=
1
i
=
1
i
=
1
n
n
n
W
i
x
i
+
W
i
x
i
W
i
x
i
y
i
a
b
=
(3.26b)
i
=
1
i
=
1
i
=
1
Dividing Eq. (3.26a) by
W
i
and introducing the
weighted averages
W
i
x
i
W
2
i
W
i
y
i
W
2
i
x
=
y
=
(3.27)
weobtain
a
=
y
−
b x
(3.28a)
Substituting Eq. (3.28a) into Eq. (3.26b) and solving for
b
yields after some algebra
i
=
1
W
i
y
i
(
x
i
−
x
)
b
=
i
=
1
W
i
x
i
(
x
i
−
(3.28b)
x
)
Note that Eqs. (3.28) aresimilar to Eqs. (3.19)for unweighteddata.
Fitting exponential functions
A special application of weighted linear regressionarises in fitting exponentialfunc-
tionstodata. Consideras an example the fitting function
ae
bx
f
(
x
)
=
Normally, the least-squares fit would lead to equationsthat are nonlinear in
a
and
b
.
But if we fitln
y
rather than
y
, the problemistransformed to linear regression: fit the
function
F
(
x
)
=
ln
f
(
x
)
=
ln
a
+
bx
to the datapoints (
x
i
,
=
,
,...,
n
. Thissimplification comes at aprice: least-
squares fit to the logarithmof the datais not the same asleast-squares fit to the original
data. The residuals of the logarithmic fit are
ln
y
i
),
i
1
2
R
i
=
ln
y
i
−
F
(
x
i
)
=
ln
y
i
−
ln
a
−
bx
i
(3.29a)
whereas the residuals usedinfitting the original dataare
ae
bx
i
r
i
=
y
i
−
f
(
x
i
)
=
y
i
−
(3.29b)
Search WWH ::
Custom Search