If we assume that our investment grows according to:
where we start with $
This formula ignores everything that's happened between the beginning
and the end (after N months). What we
- Consider C(1+R)
^{n}as an approximation to**A**(n) - Then, taking logarithms, we want
log{C(1+R)
^{n}} = log(C) + n log(1+R) to be an approximation to log(**A**(n)) for*every*n ... not just the first (n=0) and last (n=N). - Choose the numbers C and R so that this is the
**best**approximation, meaning that the errors are minimized (in some*optimal*way).
log( A(0)), log(A(1)), log(A(2)), ..., log(A(N))
For sanitary reasons, we let these numbers be called
So far, so good.
e
and the sum of the squares of these errors,
Σe
{y
Remember, we _{0}, y_{1}, y_{2}, etc.
(they're the logarithms of the dollar values of our investment,
after 0, 1, 2, 3, etc. months).
What we want is to choose just two numbers,
M and K, so the sum of the squares of these errors is as small as possible
(which, by the way, defines what we mean by the optimal or "Best"
... but you may have another definition). We'll call this error E(M,K), so:
E(M,K) = Σ {y and maximize like so (careful ... some Calculus here):
The solution is:
... left as an exercise ...*
Here's the logarithm of the TSE 300 over some 14-year period and the straight line Mn + K (with M and K as per formula, above, calculated from the logarithms of the TSE) You can use log _{10} or log_{e} or
log_{π} or whateverand the horizontal axis could be labelled 0, 1, 2, 3, ... 14 and that's
n.
Now plot |

* In general, if we want the "best" straight line fit to points (x _{1},y_{1}), (x_{2},y_{2}), (x_{3},y_{3}), ..., (x_{N},y_{N})like so: we start with a line y = Mx + K and minimize the error E(M,K) = Σ {y _{n} - (Mx_{n}+K)}^{2}
and get equations similar to those above, namely:
_{n}^{2}
+ KΣx_{n}
= Σx_{n}y_{n}
MΣx _{n}
+ KΣ1
= Σy_{n}
The solution is
Mamma mia! Uh ... did I mention that Σ1 = 1+1+1+...+1 = N ?
Of course, if you have MS Excel, the calculation of This'll give a line: y = Mx+K.The "best fit" to the Data is then EXP( y) = EXP(Mx+K) vs x
... for example:
That's because we're looking at best "straight-line" fits
We could also try to mimic the S&P directly, with y = C (1+R) Good luck! (But check out Best Fit to stock prices.) Oh, one more thingy: The Standard Deviation (SD) of any set of numbers
x_{1}, x_{2}, ..., x_{N} (not necessarily those considered above!)
is given by:SD^{2} = (1/N) Σ
(x_{n} - A)^{2}
where A is the average of the x's, namely
A = (1/N) Σ x_{n}.
Okay, to calculate SD, we - Calculate the average of the N numbers x
_{1}, x_{2}, ... That's**A**= (1/N) {x_{1}+ x_{2}+ ...} - Calculate the deviations of the numbers x
_{1}, x_{2}, ... from their average. That's (x_{1}-**A**), (x_{2}-**A**), ... - Square each of these deviations.
That's (x_{1}-**A**)^{2}, (x_{2}-**A**)^{2}, ... - Calculate the average of these squares.
That's**SD**^{2}!
Of course, who's to say that minimizing the Mean
Squared Error is really the "?Best Fit"
Suppose e
Normally we wish to minimize
SQRT{(1/N)Σ
e
Let's compare these two "error measures". Under what conditions will
(1/N)Σ e
This will be true if:
{(1/N)Σ
e
And this will be true if:
(1/N)Σe
which we recognize as a Standard Deviation,
so the inequality is true if the Standard Deviation of the errors, e But any Standard Deviation is
Conclusion? The MEAN of the |