Nonlinear Regression

Exponential Model
bx
Given ( x1 , y1 ), ( x2 , y2 ), ... , ( xn , yn ) best fit y  ae to the data.
(x , y )
n
n
(x , y )
2
2
y  ae bx
(x , y )
i
( x1 , y1 )
i
y i  ae bxi
Figure. Exponential model of nonlinear regression for y vs. x data
1
http://numericalmethods.eng.usf.edu
Finding Constants of Exponential Model
The sum of the square of the residuals is defined as
n

Sr   yi  ae
i 1

bx 2
i
Differentiate with respect to a and b
n
S r
bxi
bxi
  2 y i  ae  e  0
a
i 1





n
S r
bxi
bxi
  2 y i  ae
 axi e  0
b
i 1
2

http://numericalmethods.eng.usf.edu
Finding Constants of Exponential Model
Rewriting the equations, we obtain
n
  yi e
bxi
i 1
n
 y i xi e
i 1
3
bxi
n
 a  e 2bxi  0
i 1
n
 a  xi e
i 1
2bxi
0
http://numericalmethods.eng.usf.edu
Finding constants of Exponential Model
Solving the first equation for a yields
n
a
 yi e
bxi
i 1
n
2bxi
e

i 1
Substituting back into the previous equation
n
n
 y i xi e
i 1
bxi

 yi e
i 1
n
bxi
2bxi
e

n
2bxi
x
e
0
 i
i 1
i 1
The constant b can be found through numerical
methods such as bisection method.
4
http://numericalmethods.eng.usf.edu
Example 1-Exponential Model
Many patients get concerned when a test involves injection of a
radioactive material. For example for scanning a gallbladder, a
few drops of Technetium-99m isotope is used. Half of the
Technetium-99m would be gone in about 6 hours. It, however,
takes about 24 hours for the radiation levels to reach what we
are exposed to in day-to-day activities. Below is given the
relative intensity of radiation as a function of time.
Table. Relative intensity of radiation as a function of time.
t(hrs)

5
0
1
3
5
7
9
1.000
0.891
0.708
0.562
0.447
0.355
http://numericalmethods.eng.usf.edu
Example 1-Exponential Model cont.
The relative intensity is related to time by the equation
t
  Ae
Find:
a) The value of the regression constants A and 
b) The half-life of Technetium-99m
c) Radiation intensity after 24 hours
6
http://numericalmethods.eng.usf.edu
Plot of data
7
http://numericalmethods.eng.usf.edu
Constants of the Model
  Aet
The value of λ is found by solving the nonlinear equation
n
n
f      i t i e
ti
i 1

ti

e
 i
i 1
n
2ti
e

n
2ti
t
e
0
 i
i 1
i 1
n
A
t

e
 i
i
i 1
n
2 t i
e

i 1
8
http://numericalmethods.eng.usf.edu
Setting up the Equation in MATLAB
n
n
f      i t i e
i 1
ti

 ie
i 1
n
e
ti
n
 ti e
2ti i 1
2ti
0
i 1
t (hrs)
0
1
3
5
7
9
γ
1.000 0.891 0.708 0.562 0.447 0.355
9
http://numericalmethods.eng.usf.edu
Setting up the Equation in MATLAB
n
n
f      i t i e
i 1
ti

 ie
i 1
n
e
i 1
ti
n
2ti
t
e
0
 i
2ti i 1
  0.1151
t=[0 1 3 5 7 9]
gamma=[1 0.891 0.708 0.562 0.447 0.355]
syms lamda
sum1=sum(gamma.*t.*exp(lamda*t));
sum2=sum(gamma.*exp(lamda*t));
sum3=sum(exp(2*lamda*t));
sum4=sum(t.*exp(2*lamda*t));
f=sum1-sum2/sum3*sum4;
10
http://numericalmethods.eng.usf.edu
Calculating the Other Constant
The value of A can now be calculated
6
A
 e
i 1
6
ti
i
2 ti
e

 0.9998
i 1
The exponential regression model then is
  0.9998 e
11
0.1151t
http://numericalmethods.eng.usf.edu
Plot of data and regression curve
  0.9998 e
12
0.1151t
http://numericalmethods.eng.usf.edu
Relative Intensity After 24 hrs
The relative intensity of radiation after 24 hours
  0.9998  e
0.115124 
 6.3160  10
2
This result implies that only
6.316  102
 100  6.317%
0.9998
radioactive intensity is left after 24 hours.
13
http://numericalmethods.eng.usf.edu