NAME: (write your name here!!) FIN285a: Computer Simulations and Risk Assessment Midterm Exam II: Wednesday, November 16, 2016 Fall 2016: Professor B. LeBaron Directions: Answer all questions. You have 1 hour 15 minutes. Point weightings are listed next to each problem. There are 100 points total. Answer what you know first, and then go back to other problems. Stay calm, and good luck. Part I: Interpreting matlab code: In the following problems you will be asked to interpret some example matlab programs. 1. (3 points each part) What is the output of the following matlab programs: a.) x = -5:5 find(x<0) [1 2 3 4 5] b.) prod(2:4) 24 c.) gpcdf(0,1/5,5) 0 d.) datestr(1) % approximate answers are fine 01-Jan-0000 (any date, or format close to this is totally fine) Fin285a Page 1 of 6 Midterm Two: Fall 2016
2. (16 points) Answer this question referring to the following matlab code: n = 10000; p1 = 101 + randn(n,1); p0=100; v0=100; v1 = 101+(p1-101).^3; v1star = quantile(v1,0.01); v = -(v1star-v0) p2 = norminv(0.01,101,1); v1a = v0 + 3*(p2-p0); vv = -(v1a-v0) a.) What is v estimating? Be specific here. (Hint: it is a type of VaR.) Monte-carlo VaR, p = 0.01 b.) What is vv estimating? Be specific here. (Hint: it is a type of VaR) Delta normal VaR, p = 0.01 c.) If you know that the v1 function is correct, and p1 represents the true distribution of future prices, then which VaR number would you prefer, v, vv, or are you indifferent? v because the monte-carlo with the true v function is better d.) Can you predict what would happen if we changed the v1 equation to, v1 = 101+(p1-101)? (a linear relationship) How close would vv and v be? With a linear function, the linear approximation to v1 is exact. The values for v and vv should be almost the same. (Actually, delta-normal would be the correct VaR to use here.) Fin285a Page 2 of 6 Midterm Two: Fall 2016
3. (16 points) Answer this question referring to the following matlab code: % ret1 are one day log returns h = 40; for i = 1:100000 ret1bs = datasample(ret1,h) port40daysbs(i) = prod(exp(ret1bs))*100; end var1 = 100-quantile(port40daysbs,0.01); index = 1:nsamp-(h-1); for i = 1:100000 start = datasample(index,1); ret1bs = ret1(start:startt+(h-1)); port40daybs(i) = prod(exp(ret1bs))*100; end var2 = 100-quantile(port40daysbs,0.01); a.) Does the first for loop and VaR calculation assume that returns are normally distributed (yes or no)? yes, iid bootstrap b.) Does the first for loop assume that returns are independent over time (yes or no)? Yes, iid bootstrap c.) What type of bootstrap is the second loop doing? Block bootstrap d.) In our examples from class which of the two VaR measures (var1 or var2) was larger? Var2 Fin285a Page 3 of 6 Midterm Two: Fall 2016
4.) (16 points) Answer this question referring to the following matlab code: load retus.mat; % ret = one day arithmetic returns ret1 = log(1+ret); rr1 = ret; s = std(ret1); m = mean(ret1); r1 = studenttinv(0.01,4,m,s); p1 = 100*exp(r1); v1 = -(p1-100); m1 = mean(rr1); s1 = std(rr1); rs = norminv(0.01,m1, s1); rt = -s1*normpdf( (rs-m1)/s1)/0.01 + m1; x = -100*rt; a) What is the value v1 measuring? (risk measure, horizon, prob) VaR, p = 0.01, 1 Day b.) What did it assume about returns (log or arithmetic, distribution)? Log, student-t c.) What is x estimating? What assumptions are made about return distributions? Arithmetic returns are normally distributed d.) Is it necessary for the program to estimate m1 and s1 given that it already knew m, s? (Yes or no, why or why not.) Yes, because we need the mean and standard deviation for the arithmetic returns, not the geometric ones. Fin285a Page 4 of 6 Midterm Two: Fall 2016
Part II. Multiple choice (3 points each): Circle the one best answer from the choices. 5.) The skew of a log normal distribution is always >a.) positive b.) negative c.) infinite d.) 3 6.) Confidence intervals a.) make you confident about your estimate b.) always require a bootstrap simulation >c.) contain the true value with high probability d.) have to be symmetric. 7.) In class we used parametric formulas for expected shortfall. For these formulas to work which of the following assumptions do we need? >a.) Arithmetic returns needed to follow a normal distribution. b.) Log returns needed to follow a normal distribution. c.) Returns could follow any distribution. d.) Returns needed to follow a student-t distribution. 8.) Estimating a Generalized Pareto Distribution GPD gives an estimate of the tail exponent. This value tells you a.) which moments exist. b.) a relationship between VaR and expected shortfall. c.) the slope for linear scaling relationships in log/log plots. >d.) all of the above. 9.) Returns follow a student-t distribution with 3 degrees of freedom. What is their kurtosis? a.) 3 b.) 4 c.) 5 >d.) undefined, or infinite 10.) You are 100 percent sure that your risk factors follow a well-defined normal distribution, and you know all the parameters. Also, you face a complicated nonlinear valuation formula for your portfolio. You best option for risk evaluation is a.) historical >b.) monte-carlo c.) bootstrap d.) delta-normal Fin285a Page 5 of 6 Midterm Two: Fall 2016
Part III. Very short answer. Answer the following with numbers or a few words. 11. (12 points) Consider a world where the daily log return, r, for your portfolio follows a normal distribution with mean 0, and standard deviation, s=0.5. Log returns are independent over time. The initial price is 100. a.) What is the std for the 4 day log return? S4 = Sqrt(4) * 0.5 = 1 b.) What is the final formula for the 4 day VaR at the 0.025 level? Assume for simplicity that the 0.025 quantile for a standard normal is -2. You may need to leave an exp(x) in your answer, and this is fine. Rstar = -2*s4 = -2, VaR = -(100exp(-2) 100) 12. (5 points) You have a portfolio with a future price in one day. Can you estimate the VaR(0), or maximum possible loss when one day log returns are normally distributed? P(t+1) = P(t)exp(r(t+1)), P(t) = 100. (portfolio = 1 share) Yes, 100, min (P(t+1)) = 0, VaR = 100-0 = 100 13. (5 points) You have used a generalized Pareto CDF to find that the prob(x<=0.10 X>0.05) = 0.80. You also know that the prob(x<=0.05) = 0.99. information to find the prob(x>0.1). Use this Prob((X>0.10) (X>0.05)) = 1-0.8 = 0.2 Prob((X>0.10)&((X>0.05) = Prob((X>0.10) (X>0.05))*Prob(X>0.05) = 0.2 * (1-0.99) = 0.002 Fin285a Page 6 of 6 Midterm Two: Fall 2016