Question

In: Computer Science

Python Problem Suppose you invest $50,000 today into some kind of investment fund. Assume that investments...

Python Problem

Suppose you invest $50,000 today into some kind of investment fund. Assume
that investments in this fund grow by some rate that is not entirely predictable.
However, we believe growth of the fund to be normally distributed with an av-
erage growth of 7% and standard deviation of 5%. The following chart displays
the believed relative likelihood of various growth amounts for this fund.
As we can see above, a wide range of growth rates are possible, but the bulk of
them are clustered around 7% growth (0.07).
Simulating a single possible outcome for the fund is not nearly as valuable
as simulating many potential outcomes for the fund. Therefore, we wish to do
100,000 simulations of the possible values after 30 years.
To do so, we could use the following code (see the .py le referenced at the
beginning of this question).
import numpy
listOfOutcomes = []
for i in range(100000):
currentValue = 50000
for year in range(30):
growth = numpy.random.normal(0.07,0.05)
currentValue *= (1+growth)
finalValue = currentValue
listOfOutcomes.append(finalValue)
At the end of the simulation, the variable listOfOutcomes has a length of
100,000 and records the nal value of the fund at the end of each of the 100,000
simulations. The variable listOfOutcomes is of the list data type.
Part (a): utilize the sort() method of the list data type to sort the outcomes.
Part (b): what was the lowest value observed in your simulation? (Hint: because
we sorted the list, the list is sorted from least to greatest. The rst item of the list
(i.e the smallest value outcome) can be viewed by using print(listOfOutcomes[0])).
Part (c): what was the maximum value observed in your simulation? (Think
back to Question 1 and the use of negative indices to reference elements near
the end of a list.)
Part (d): compute the 90th percentile outcome. Compute the 10th percentile
outcome. (Hint: you should be able to view the 70th percentile outcome, for
example, by using print(listOfOutcomes[69999]). This prints the 70,000th
entry in a sorted list of length 100,000, so this is the 70th percentile value.)
Part (e): compute the average (mean) value of the investment in the 100,000
simulations. (Hint: using sum(listOfOutcomes) and dividing by the number
of trials might be helpful.) Is this more or less than the median value? (Recall
the median is the 50th percentile.)

Solutions

Expert Solution

Here is the required code:-

import numpy
listOfOutcomes = []
for i in range(100000):
currentValue = 50000
for year in range(30):
growth = numpy.random.normal(0.07,0.05)
currentValue *= (1+growth)
finalValue = currentValue
listOfOutcomes.append(finalValue)

#A) Sorting outcomes
listOfOutcomes.sort()

#B) Lowest Value
print("Lowest Value Observed: " + str(listOfOutcomes[0]))

#C) Highest Value
print("Highest Value Observed: " + str(listOfOutcomes[-1]))

#D) Computing 90th and 10th Percentile
print("90th Percentile Outcome: " + str(listOfOutcomes[89999]))
print("10th Percentile Outcome: " + str(listOfOutcomes[9999]))

#E) Computing Mean and compairing it with Median
n = len(listOfOutcomes)
s = sum(listOfOutcomes)
mean = s/n
print("Mean: " + str(mean))

median = listOfOutcomes[49999]
print("Meadian: " + str(median))

if mean>median:
print("Mean is more than Median.")
else:
print("Mean is less than Median.")

The code would produce the following output:-


Related Solutions

Mitchell Investments has offered you an investment opportunity. If you invest $30,000 today you will receive...
Mitchell Investments has offered you an investment opportunity. If you invest $30,000 today you will receive the following cash-flows: *$6,000 each year from years 1 through 5 *$3,000 each year from years 6 through 10 *$2,000 each year from years 11 through 20 If you required a 9% return on your investments, would this be a good investment opportunity? Show your work and justify your answer.
Mitchell Investments has offered you an investment opportunity. If you invest $30,000 today you will receive...
Mitchell Investments has offered you an investment opportunity. If you invest $30,000 today you will receive the following cash-flows: *$6,000 each year from years 1 through 5 *$3,000 each year from years 6 through 10 *$2,000 each year from years 11 through 20 If you required a 9% return on your investments, would this be a good investment opportunity? Show your work and justify your answer.
Assume you invest $4,500 today in an investment that promises to return $6,250 in exactly 10...
Assume you invest $4,500 today in an investment that promises to return $6,250 in exactly 10 years. a. Use the​ present-value technique to estimate the IRR on this investment. b. If a minimum annual return of 10% is​ required, would you recommend this​ investment?
You are an investment manager considering investments in a Stock fund and a bond fund. You...
You are an investment manager considering investments in a Stock fund and a bond fund. You forecast the following scenario probabilities and returns for the two assets: Scenario Probability Stock fund Return (%) Bond fund Return (%) Recession 1/3 -15% -9% Normal growth 1/3 6% 15% Boom 1/3 30% 9% Which of the following is closest to the volatility (standard deviation) of the Stock fund return? 10% 18% 3% 20% 14% Based on the data in Question #22, which of...
You are an investment manager considering investments in a Stock fund and a bond fund. You...
You are an investment manager considering investments in a Stock fund and a bond fund. You forecast the following scenario probabilities and returns for the two assets: Scenario Probability Stock fund Return (%) Bond fund Return (%) Recession 1/3 -15% -9% Normal growth 1/3 6% 15% Boom 1/3 30% 9% Which of the following is closest to the volatility (standard deviation) of the Stock fund return? 10% 18% 3% 20% 14% Based on the data in Question #22, which of...
Suppose you are the money manager of a $4.02 million investment fund. The fund consists of four stocks with the following investments and betas:
PORTFOLIO REQUIRED RETURNSuppose you are the money manager of a $4.02 million investment fund. The fund consists of four stocks with the following investments and betas:StockInvestmentBetaA$   400,000                                1.50B560,000                                (0.50)C1,060,000                                1.25D2,000,000                                0.75If the market's required rate of return is 9% and the risk-free rate is 5%, what is the fund's required rate of return? Do not round intermediate calculations. Round your answer to two decimal places.
How much do you have to invest today to just fund your vacation if your investments earn 4.69% APR
You plan to take a vacation in 7 months that will cost $8,200. How much do you have to invest today to just fund your vacation if your investments earn 4.69% APR (compounded monthly)?
Suppose, you invest $10,000 today in a fund that pays 5% annual interest compounded quarterly. How...
Suppose, you invest $10,000 today in a fund that pays 5% annual interest compounded quarterly. How many years will it take for the fund to double the investment?
A retired couple have $50,000 to invest. As their financial consultant, you recommend they invest some...
A retired couple have $50,000 to invest. As their financial consultant, you recommend they invest some money in Treasury Bills that yield 7%, some money in corporate bonds that yield 9%, and some money in junk bonds that yield 11%. If they want $3600 per year in income and they invest $1000 in junk bonds, find the amount they should place in each of other two investments. They should invest $_____?____ in Treasury Bills and $_____?______ in corporate bonds and...
Q2. It is your 6th birthday today. You have a trust fund with $50,000 that is...
Q2. It is your 6th birthday today. You have a trust fund with $50,000 that is earning 8% per year. You expect to withdraw $30,000 per year for 7 years starting on your 22nd birthday for graduate school. How much money will be left in the trust fund after your last withdrawal (rounded to the nearest $10)?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT