Problem 23                      Due 3/30/01

        In this problem we examine constrained 
optimization.  Suppose you are saving money for a 
particular purpose, say college education for your 
children.  You have been given a windfall (you won 
the $50,000 dollar prize in the lottery) and you want to 
invest it wisely.  You have a choice of three 
investment vehicles.  The first choice is a T-bill 
account which pays out at 7%, and is very secure (e.g.,
it pays out at a fixed rate with no variability).  The 
second is a stock market account that averages a yield 
of 10% but has a standard deviation of 10% as well 
(e.g., 69% of the time it will have a yield between 0% 
and 20%, and about 15% of the time it will actually 
lose money in a given year).  The third is an 
aggressive growth fund investing in Asian stocks and
securities which has an average annual yield of 15%,
but a volatile standard deviation of 25%.  You may assume
that the covariance of the variability in the funds
from year to year and between funds is zero (not a
great approximation, but it makes things alot easier
to calculate).

First, write a code which simulates the performance of a 
particular investment strategy (the fraction which is put into 
each investment vehicle) over time.  Since the performance
is random, use the randn command to simulate it, and plot up
the account balance as a function of time for a dozen or so
realizations.  The performance is more easily seen if you use a
semilog plot, and if you put all the realizations for a particular
strategy on the same graph.

Once you have a feel for what is going on, you need to
determine an optimum investment strategy.  The idea is to
maximize the expectation value of the return after a specified
number of years, but also to keep the uncertainty of the
return to acceptable levels.  If you didn't worry about risk, then
the optimum strategy would be to put everything in the asian
market fund - but you might go bankrupt!.  One way of quantifying
risk is to write a program which calculates both the expected return
(easy) and an estimate of the return if "bad things" happen (hard).
A possible way of quantifying this latter value is to determine
a lower bound at the 97.5% confidence level: e.g., the value for
which the actual return is greater 975 times out of 1000 realizations.

Using this, perform the following optimization problems:

a. Determine an investment portfolio mix for your $50,000 
initial investment which maximizes your expected yield, but which
after 20 years (when your children are in college) you have at least a 
97.5% chance that you will have the $150,000 you expect that 
college will cost.  How much of your initial investment do you 
put into each of the three vehicles?

b. How does your answer change if you have 
$75,000 to invest and you require a 97.5% chance that 
you will have $100,000 in five years?

For each of the above problems plot up around 10-20 realizations
of your optimum strategy, and show the expected yield and the
97.5% floor.

While it is theoretically possible to design an investment strategy
by using a simulation code, a better way is to use error propagation
equations to calculate the standard deviation of the expected
return.  Because the variability of the investments is large, however,
it is necessary to work with the log of the returns rather than the
returns themselves.  The logs of these quantities are quite well behaved,
and the standard error propagation equations apply.

You will also need to be careful in picking the correct
range for an initial value of P (assuming that you 
use penalty functions) when trying to optimize with respect
to the imposed constraint.  Also watch out for negative
values of investment - you will need to restrict the
values so that they are all positive, otherwise fminsearch
may try to make some positive and others negative.  Physically
this corresponds to taking out a loan at one rate and
investing it at another, but that is not what we are
trying to do here!