Raw Data: http://www.randomuseless.info/gasprice/gasprice.txt
Model:
where
is the rate of inflation. This can also be written as:
Given series of data points construct cost fn.
Need to find and
that minimize
.
Simplify above two equations to
….(1)
and
….(2)
where
Simplify (1) to give
….(3)
substitute value of from (3) into (2) to give
Now use Newton’s method to find roots of
After lots of algebra, verify
where
Code: http://sdrv.ms/MWaGWo
Output of program (Newton’s method):
= 0.0584642367944379, residual = 8264.22684488131
= 0.0394587424266077, residual = 755.065800336963
= 0.0373150889455502, residual = 11.93657393052
= 0.0372800836836129, residual = 0.00330268916627574
Rate of inflation: 3.798%
Residual = 0.00330268916627574
Iterations = 4
