As before, we assume that our stock grows according to: P(n) = C (1 + R)n
where we start with a price $C and, after n months (days? years?),
the price is $P(n), where R is some "Best Fit" monthly return.
E(C,k) = Σ{ yn - C kn }2 As before, we set the two derivatives to zero, like so:
(1) d/dC E(C,k)
= 2Σ{ yn - C kn }kn = 0
These may be rewritten, like so:
(3)
Σ yn kn - C Σk2n = 0
Hence we can solve for C, like so: (5) C = Σ yn kn / Σk2n = Σ n yn kn-1 / Σn k2n-1 from which we get an equation to solve for k = 1 + R If we define:
(6) C = f(k) / g(k) = f '(k) / [(1/2) g '(k)] Now we cross-multiply, in equation (6), and define: F(k) = f(k) g '(k) - 2 f '(k) g(k) and we wish to solve F(k) = 0 for k. We can solve this using Newton's Method, which requires iterating: k - F(k) / F '(k). Note that: F '(k) = f(k) g ''(k) - f '(k) g(k) - 2 f ''(k) g(k) Let's recall our definitions:
Now, using Newton's Method, starting with an initial guess given by the Excel functions: k = INDEX(LOGEST(yn, n), 1) C = INDEX(LOGEST(yn, n), 2) we get both "Best Fit" charts Note: The Excel function LOGEST(y:array, x:array) gives the parameters for the "Best Fit to the logarithm".
|