As we have seen, any two runs generated from the same set of parameters might vary...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
As we have seen, any two runs generated from the same set of parameters might vary considerably from one-another. You might be asking how simulation is useful if I get very different results every time we run a simulation. The answer is that we do not expect simulation to be able to tell us exactly what will occur, we use it to get an idea of the range of possible outcomes that might occur. In order to perform that sort of analysis, we need to perform many simulations, and then look at the range of outcomes occurring in this simulations. The process of performing several simulations to estimate probabilities relating to the outcome of a certain event is called Monte Carlo Simulation. Create a markdown cell that displays a level 2 header that reads: "Part D: Monte Carlo Simulation". Also add some text briefly describing the purpose of your code in this part. Write a function named monte_carlo. The function should accept five parameters: start, rate, vol, days, and num_runs. The function should use a loop to generate a number of simulated stock runs equal to num_runs. The characteristics of the runs are provided by the parameters start, rate, vol, and days. A detailed description of this function is provided below. Each time you loop executes, the following steps should be performed: 1. Simulate a run using the supplied parameters. Store the resulting array in a variable. 2. Determine the final simulated price of the stock and append it into a list called final_prices. 3. Determine the annual yield for the simulated run and append it into a list called annual_yields. When the loop is done executing, convert the two lists you have constructed to numpy arrays and return both of them. Create a markdown cell to explain that you are about to test the function by running a Monte Carlo simulation with a specific seed. Set a seed of 1, and run a Monte Carlo simulation consisting of 10,000 simulated runs for a stock with a current price of 200, an expected annual return of 10 %, and a volatility of 0.4. Each run should be over a period of 500 days. Create a histogram of the final prices. Use bins=np.arange(0, 1600, 50), and set the edgecolor to black. Set the size of the figure to be [10,5]. If your code is correct, your histogram should have a peak around 200 and should have a long tail trailing off to the right. This shows that the majority of the simulated final prices are near 200, but there are some very large outliers. Create a markdown cell to explain that you are about to display the 10th, 25th, 50th, 75th, and 90th percentiles of the simulated final prices. Use np. percentile to calculate the 10th, 25th, 50th, 75th, and 90th percentiles for the final prices in the simulated runs generated for the stock. Display the results by creating five lines of output, with each line using the following format: __th percentile: Round the display percentiles to 2 decimal places. If done correctly, you should get a 10th percentile of 118.05 and a 90th percentile of 505.91. As we have seen, any two runs generated from the same set of parameters might vary considerably from one-another. You might be asking how simulation is useful if I get very different results every time we run a simulation. The answer is that we do not expect simulation to be able to tell us exactly what will occur, we use it to get an idea of the range of possible outcomes that might occur. In order to perform that sort of analysis, we need to perform many simulations, and then look at the range of outcomes occurring in this simulations. The process of performing several simulations to estimate probabilities relating to the outcome of a certain event is called Monte Carlo Simulation. Create a markdown cell that displays a level 2 header that reads: "Part D: Monte Carlo Simulation". Also add some text briefly describing the purpose of your code in this part. Write a function named monte_carlo. The function should accept five parameters: start, rate, vol, days, and num_runs. The function should use a loop to generate a number of simulated stock runs equal to num_runs. The characteristics of the runs are provided by the parameters start, rate, vol, and days. A detailed description of this function is provided below. Each time you loop executes, the following steps should be performed: 1. Simulate a run using the supplied parameters. Store the resulting array in a variable. 2. Determine the final simulated price of the stock and append it into a list called final_prices. 3. Determine the annual yield for the simulated run and append it into a list called annual_yields. When the loop is done executing, convert the two lists you have constructed to numpy arrays and return both of them. Create a markdown cell to explain that you are about to test the function by running a Monte Carlo simulation with a specific seed. Set a seed of 1, and run a Monte Carlo simulation consisting of 10,000 simulated runs for a stock with a current price of 200, an expected annual return of 10 %, and a volatility of 0.4. Each run should be over a period of 500 days. Create a histogram of the final prices. Use bins=np.arange(0, 1600, 50), and set the edgecolor to black. Set the size of the figure to be [10,5]. If your code is correct, your histogram should have a peak around 200 and should have a long tail trailing off to the right. This shows that the majority of the simulated final prices are near 200, but there are some very large outliers. Create a markdown cell to explain that you are about to display the 10th, 25th, 50th, 75th, and 90th percentiles of the simulated final prices. Use np. percentile to calculate the 10th, 25th, 50th, 75th, and 90th percentiles for the final prices in the simulated runs generated for the stock. Display the results by creating five lines of output, with each line using the following format: __th percentile: Round the display percentiles to 2 decimal places. If done correctly, you should get a 10th percentile of 118.05 and a 90th percentile of 505.91.
Expert Answer:
Answer rating: 100% (QA)
Lets break down the instructions step by step and create the required Python code and Markdown cells to perform a Monte Carlo simulation and analyze t... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Sam received a Section 1245 asset (heavy truck) that his grandfather used and depreciated in connection with a trade or business. At the time Sam received the truck, the FMV was $12,000, original...
-
When creating a project schedule, which question should you ask to determine the resources that will impact the schedule? a.) b.) c.) d.) Which equipment and materials are needed? What sequence must...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In 2022, XYZ issued, at par, 75 1,000 K.D, 10% bonds, each convertible into 100 ordinary shares. The liability component of convertible bonds was 950 K.D per bond. XYZ had revenues of 24,800 K.D and...
-
If a diffraction grating produces its third-order bright band at an angle of 78.4 for light of wavelength 681 nm, find (a) The number of slits per centimeter for the grating and (b) The angular...
-
You are considering new elliptical trainers and you feel you can sell 5,000 of these per year for 5 years (after which time this project is expected to shut down when it is learned that being fit is...
-
Consider heat transfer over a flat plate again but now include an additional term due to viscous heating. Show that the similarity method is applicable to this problem as well, and derive the...
-
Luke Gilbert is to retire from the partnership of Gilbert and Associates as of March 31, the end of the current fiscal year. After closing the accounts, the capital balances of the partners are as...
-
Using a discount rate of 4.5% compounded annually, a pension fund estimates that the present value of its assets and liabilities are $14 million and $13 million, respectively. The duration of the...
-
Finley Heaters Inc. is a mid sized manufacturer of residential water heaters. Sales have grown during the last several years, and the companys production capacity needs to be increased. The companys...
-
At which stage of a prototypical product life cycle do sales peak? Group of answer choices Maturity Introduction Product development Growth Decline 111 pts When a company uses this pricing technique...
-
Explain array with classes.
-
What is the major cause of death for children in the United States?
-
What is the purpose of loops in programming?
-
Briefly highlight on the concept of access control mechanism as used in computer security.
-
Find two regression equations when it is given that X=68.2, Y=9.9, OY = 0.44 and r = 0.7.
-
Which of the following statements is true regarding dermatomes? Multiple Choice O Each dermatome provides sensory input from a broad area of the skin (e g. the entire upper limb) to a specific spinal...
-
Refer to the information from Exercise 22-19. Use the information to determine the (1) Weighted average contribution margin , (2) Break-even point in units, and (3) Number of units of each product...
-
The Royal Elbonian Yacht Club (REYC) is an association of members that offers a number of services: community and friendship among members, sailing courses for its members, meals in its restaurant,...
-
Oculus is a proprietorship that produces a specialized type of round window. It is after the fiscal year-end for 2019, and the owner has drafted the financial statements for the business for...
-
Liz Hicks Accounting Ltd.s (LHA) policy is to report all cash flows arising from interest and dividends in the operating section. LHA owns a 30% interest in an associated company, LH Bookkeeping Inc....
-
When the Glen Canyon hydroelectric power plant in Arizona is running at capacity, 690 m 3 of water flows through the dam each second. The water is released 220 m below the top of the reservoir. If...
-
A pronghorn, the fastest North American animal, is capable of running at 18 m/s (40 mph) for 10 minutes, after which it must slow down. The time limit isnt because the pronghorn runs out of energy;...
-
When the hoof of a galloping horse hits the ground, the digital flexor tendon in its lower leg may stretch by 5% in length, a significant stretch for this 45 cm tendon. The tendon is elastic; mostbut...
Study smarter with the SolutionInn App