Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Monte Carlo - Area of Illinois 10 points Computing the area of objects that are

ID: 3887322 • Letter: M

Question

Monte Carlo - Area of Illinois 10 points Computing the area of objects that are odd shapes can be quite difficult. However, Monte Carlo simulation can be used to easily find the areas of objects that are odd shapes This problem will focus on using Monte Carlo simulation to compute the area of an object that is an odd shape, specifically the state of Illinois. Consider this outline picture of the state of Illinois. This picture is adapted from one on Wikimedia, Write Python code that uses Monte Carlo simulation with this picture to estimate the area of the state of Illinois. Pixels in the picture that are black are inside of Illinois and pixels in the picture that are white are outside of Illinois. The size of the picture corresponds to a physical distance of 304 miles wide by 450 miles tall Your code will see a variable called img which is a numpy array containing the image data. The image is black and white -- the entries in img are either 0 or 255. If you wish to program this on your local machine, you will want to download the image and use scipy.misc. inread name) , where fname is a string of the file name. Note, you do not need to (and can't do that when submitting your code here. When submitting your code here, you should use the variable img which is already a numpy array with the image data. The random number generator is seeded in the startup code). You must use np. random, rand into to generate your random numbers. For each trial, you will need to generate a random integer col in the image array and another random integer row in the image array. They must be generated in this order, col first then row. See the example in the starter code below. Your code should produce a variable called area which is a float with the estimate of the area of Illinois (in square miles) obtained using Monte Carlo simulation. Use 10 trials (points) to determine the area To determine the accuracy of your simulation, you will use another method to get the area of Illinois. Count the number of black pixels in the image, and use this along with the information given above to get a more accuracte calculation of the area of Illinois. Using this value as the true solution, compute the relative error of the solution from the simulation. Store this value as relerror INPUT .img : 0 and 255 matrix, O representing points within Illinois OUTPUT . area: float with the estimate of Illinois (in square miles) obtained by Monte Carlo simulations Aeal value-Predicted val rel_error: Actual value

Explanation / Answer

One way to employ a Monte Carlo simulation is to model possible movements of asset prices using Excel or a similar program. There are two components to an asset's price movements: drift, which is a constant directional movement, and a random input, representing market volatility. By analyzing historical price data, you can determine the drift, standard deviation, variance and average price movement for a security. These are the building blocks of a Monte Carlo simulation.

To project one possible price trajectory, use the historical price data of the asset to generate a series of periodic daily returns using the natural logarithm (note that this equation differs from the usual percentage change formula):

periodic daily return = ln (day's price ÷ previous day's price)

Next use the AVERAGE, STDEV.P and VAR.P functions on the entire resulting series to obtain the average daily return, standard deviation and variance inputs, respectively. The drift is equal to:

drift = average daily return - (variance ÷ 2)

Alternatively, drift can be set to 0; this choice reflects a certain theoretical orientation, but the difference will not be huge, at least for shorter time frames.

Next obtain a random input:

random value = standard deviation * NORMSINV(RAND())

The equation for the following day's price is:

next day's price = today's price * e ^ (drift + random value)

To take e to a given power x in Excel, use the EXP function: EXP(x). Repeat this calculation the desired number of times (each repetition represents one day) to obtain a simulation of future price movement. By generating an arbitrary number of simulations, you can assess the probability that a security's price will follow given trajectory. Here is an example, showing around 30 projections for the Time Warner Inc's (TWX) stock for the remainder of November 2015:

The frequencies of different outcomes generated by this simulation will form a normal distribution, that is, a bell curve. The most likely return is at the middle of the curve, meaning there is an equal chance that the actual return will be higher or lower than that value. The probability that the actual return will be within one standard deviation of the most probable ("expected") rate is 68%; that it will be within two standard deviations is 95%; and that it will be within three standard deviations is 99.7%. Still, there is no guarantee that the most expected outcome will occur, or that actual movements will not exceed the wildest projections.

Crucially, Monte Carlo simulations ignore everything that is not built into the price movement (macro trends, company leadership, hype, cyclical factors); in other words, they assume perfectly efficient markets. For example, the fact that Time Warner lowered its guidance for the year on November 4 is not reflected here, except in the price movement for that day, the last value in the data; if that fact were accounted for, the bulk of simulations would probably not predict a modest rise in price.



Read more: Monte Carlo Simulation http://www.investopedia.com/terms/m/montecarlosimulation.asp#ixzz4tEZNShMg
Follow us: Investopedia on Facebook

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote