Financial Simulation N. Gershun
Overview is a spreadsheet add-in that has two advantages. provides easy access to many probability distributions. 2. Add-ins make it easier to develop simulation models than Excel alone. Overview features: Many built-in input probability distributions. Output cells can be maintains statistics for these cells across replications. The Risksimtable command allows the user to run the simulation several times for different values of input parameters.
Overview The development of a simulation model is a two-step process: 1. Build the model, that is, the logic that transforms input (e.g., stock price) into output (e.g., profit/loss on a portfolio). automatically replicates the model with many random input values, reporting output as requested. takes any spreadsheet (e.g., income statement, cash flow statement) and specifies that some of the cells are then repeats the simulation many times and computes statistics across replications. is really an advanced sensitivity analysis since it studies how changes to key input parameters impacts output. Although we a similar add-in is Crystal Ball.
Fitting a Probability Distribution Historical data are needed to estimate probability distributions and values for uncertain parameters. Suppose we believe that the probability distribution of stock returns can be estimated using the past data that was gathered and appears in the returns.xls file.
Fitting a Probability Distribution We can use the “Fit Distributions to Data” button to analyze the data. After selecting this button, enter the following information: Excel Data Range, Type of Data (Sampled Values), No Filtering Options, Continuous Domain, and OK. will analyze the data and use goodness of fit statistical tests to rank order probability distributions and their parameters for the data entered. We are now ready to create our model.
The problem Suppose today is October 9 th 2010, and the current price of oil is $3.05 per gallon. You want to purchase 500,000 gallons of heating oil 5 months from now (March 9 th, 2011). To hedge your risk, today you long x futures which give you the right to receive x gallons of heating oil for $3.10 on April 9 th, Suppose you buy the heating oil and also close out your futures contract on March 9 th, What can happen?
What can happen? The price of heating oil increases between now and March 9 th, 2011 Cost of buying oil goes up (bad). The value of futures contracts increases because you have the right to receive a more valuable commodity, sell it on the open market and make some money (good). If the price of heating oil drops Cost of purchasing oil decreases the value of the futures drops Going long the future has created a hedge that reduces the effect of change in the price of heating oil between now and March.
Brief Review of Futures Contracts Buying (shorting) a futures contract means that you bought a right to buy (sell) a pre-specified asset (underlying asset) at a pre-specified price (called futures price, F) at a pre-specified time. Pricing Formula (ignoring storage costs): F = Se rt(1) S = the current spot price of an underlying asset r = risk free rate t = time to expiration
What do you need to decide ? You need to determine how many futures to go long.
Assumptions : Oil prices follow a Lognormal distribution mean growth rate = 0.38 standard deviation of the growth rate = 0.30 We are hedging by buying oil futures that expire on April 9 th, We close out the futures on March 9 th, 2011.
Assumptions (cont.): Equation (1) tells us that given the current risk free rate r and the current spot price S, a futures contract of duration t should sell for F= Se rt. In reality futures prices will vary around this “expected price.” Futures price follows normal distribution with the mean given by equation (1) and the standard deviation of 10%.
Assumptions (cont.): Assume for the moment that we are buying 500,000 futures, the same number as the number of gallons of oil we have to purchase. The risk free rate is constant at 2% per annum. PROCEED TO THE SIMULATION
Step 1: Input Parameters In B6 enter the current market price of oil ($3.05) In B7 enter the annual risk free rate (2%) In B8 enter the annual volatility (standard deviation) of the oil prices (0.3) In B9 enter the mean growth rate (drift) of oil prices (0.38) In B10 enter the standard deviation of futures prices (0.1)
Step 1: Input Parameters (cont.) In B11 enter the futures time to expiration (0.5 year or 6 months) In B12 enter the price of April 9 th futures as of today (October 9 th ). It is $3.10 In B13 enter the amount of oil you want to buy (500,000 gallons) Number of futures bought (500,000 as a starting point).
Step 2: Input Formulas In B15 enter the formula to We use the formula for a log- normal random variable: In B15 enter the formula to generate the March 9 th spot price of oil, five months from now (t = 5/12). We use the formula for a log- normal random variable: S t = S 0 exp[( -0.5 2 )t+Z(0,1) t] (2) S t = price of oil at time t S 0 = current spot price of oil Z(0,1) = standard normal random variable
Step 2: Input Formulas (cont.) In B15 enter the formula: =B6*EXP((B9-0.5*B8^2)*(5/12) +risknormal(0,1)*SQRT(5/12)*B8) In B16 enter the formula determining the mean price of oil on March 9 th, 2001 (use equation (1)): =B15*EXP((1/12)*B7)
Step 2: Input Formulas (cont.) In B17 In B17 build in the 10% standard deviation of the actual future price from the expected future price, thus getting the actual price of the April 9 futures on March 9. = risknormal(B15,B10*B16) In B19 compute the cost of buying oil at the March 9 th spot price =B15*B13 In B20 compute the revenue earned from selling futures on March 9 th as =B17*B14
Step 2: Input Formulas (cont.) In B21 we compute the cost of buying our futures on October 9 th with the formula =B12*B14 In B22 find the total cost as: oil purchase cost +futures purchase cost –futures sales revenue =B19 + B21 – B20
AB Hedging Petroleum Risk 6October 9 oil price per gallon3.05 7Risk free rate0.02 8Volatility of oil price0.3 9Mean growth rate of oil price (drift) Percentage deviation of futures price from its expected value Futures duration0.5 12April futures price on October 9 th Gallons of oil bought500,000 14Number of futures long500,000 15March 9 th price of oil=B6*EXP((B9-0.5*B8^2)*(5/12)+RiskNormal(0,1)*SQRT(5/12)*B8) 16Mean of March 9 th price of April futures =B15*EXP((1/12)*B7) 17Actual March 9 th futures price=RiskNormal(B16,B10*B16) 18 19Cost of buying oil=B15*B13 20Revenue from futures=B17*B14 21Cost of buying futures on October 9 th =B12*B14 22Total cost=B19+B21-B20
Step 3: Select Simulation Settings With cell B22 highlighted, choose the Add Output button to make this the output cell. Select B22 (total cost with futures) and B19 (total cost without futures, i.e., just buying the oil) as the outputs and run the simulation. With cell B22 highlighted, choose the Add Output button to make this the output cell. Do the same with B19. Click on the Simulation Settings button and select 1000 iterations and 1 simulation in the Iterations tab. In the sampling tab of the Simulation Settings button, select Latin Hypercube, Standard Recalc (Monte Carlo), Fixed = 1, All, check Save as Default, and OK.
Note on Sampling Sampling is the process by which values are randomly drawn from the selected distribution. during each iteration of the simulation, one observation is chosen from the input distribution. As the number of iterations increases, the sample of observations more closely resembles the input distribution. When running a simulation, it is important that all areas of the input distribution get sampled, especially the low probability (high uncertainty) areas. If not, uncertainty will seem less than it actually is.
The Concept of “Efficiency ” Statisticians have developed different ways to sample (or draw) from distributions. If we could do an infinite number of iterations in our simulation, these methods would produce equal results. However, since we use a finite number of iterations, different sampling methods do not produce equivalent results. A sampling method is considered more efficient than another if it approximates a distribution with fewer iterations. Two popular sampling methods: Monte Carlo Simulation Latin Hypercube
Monte Carlo Simulation Monte Carlo simulation draws samples from the full range of the distribution on each draw. It is an entirely random sampling technique. Requires a large number of iterations to adequately approximate the input distribution. Why? Most observations drawn are closer to the mean. Creates clustering. The tails (areas of high uncertainty) are usually underrepresented in the sampling.
Latin Hypercube Latin Hypercube samples from all parts of the distribution, reducing clustering. Not entirely random (is a “stratified” sampling method) Latin Hypercube divides a distribution into intervals (strata) of equal probability and randomly draws from each interval. Insures that all portions of the distribution are sampled, including the tails. Latin Hypercube sampling is more efficient than Monte Carlo sampling: Requires fewer iterations.
Example : Suppose we sample 8 times from a normal distribution. With Monte Carlo sampling we might get: Source: Modeling the Future: The Full Monte, the Latin Hypercube and Other Curiosities by Glenn Kautt, CFP, and Fred Wieland, Ph.D., FPA Journal Notice that the tails (high uncertainty areas) are not adequately represented. This results in underestimating risk
Example continued With Latin Hypercube, we would get: Source: Modeling the Future: The Full Monte, the Latin Hypercube and Other Curiosities by Glenn Kautt, CFP, and Fred Wieland, Ph.D., FPA Journal Notice that even with only 8 observations, the tails are much more adequately represented. This results in a truer representation of risk. The area in each strata is equal but the width of each strata varies.
Step 4: Select Report Settings Click on the Report Settings button and select: Show Results Window Generate Excel Reports Selected Below Simulation Summary Output Graphs, Active Workbook Metafile Check Save as Default, and OK.
Step 5: Run the Simulation To run the simulation, select the Start Simulation button. will create a Results window. Choose the Detailed Statistics Window to display additional output.
Simulation Results NameCellMinMeanMax95% percentile Total cost without futures B19$903,680$1,786,812$3,644,913$2,406,835 Total cost with futures B22$789,661$1,544,200$2,145,186$1,842,001
Step 6: Choosing the Number of Futures to Buy (Long) The objective of this problem is to choose the number of futures contracts that minimizes the cost of buying oil and reduces the risk of this transaction. can automatically evaluate several possibilities on the same set of random oil prices and futures prices. The Risksimtable command accomplishes this. Enter “Number of Futures to Buy” in cell A25 and the desired quantities in cells B25 – F25: 200,000, 300,000, 400,000, 500,000, and 600,000.
Step 6: Choosing the Number of Futures (cont.) In cell B9 enter: =Risksimtable(B25:F25) Set number of iterations to Set number of simulations to 5. Run the simulation.
Simulation Results Number of Futures to Buy 200,000300,000400,000500,000600,000 Average Total Cost$1,690,943$1,643,084$1,595,225$1,547,366$1,499,507 SD Total Cost$223,889$179,717$163,056$181,640$226,971 95% Risk Percentile (VaR) $2,103,529$1,972,014$1,897,501$1,835,359$1,852,763