% Copyright (c) 2001-2009 by Ales Cerny %************************************************************************% % chapter3exe5.m - supplementary program to % % Ales Cerny (2009) Mathematical Techniques in Finance (2nd ed.) % % Princeton University Press http://press.princeton.edu/titles/9079.html % %************************************************************************% % This code is provided 'as-is', without any express or implied warranty. % % Permission is granted to anyone to use this code for any purpose, % subject to the following restrictions: % % 1. The origin of this code must not be misrepresented; you must not % claim that you wrote the original code. % 2. Modified code versions must be plainly marked as such, and must not % be misrepresented as being the original code. % 3. This notice may not be removed from any source distribution. % NOTICE TO STUDENTS: To avoid accusations of plagiarism, if you use this % code or its modifications in assessed work you should prepend it with a % note stating: % "This is the original/modified version of the code chapter3exe5.m by % Ales Cerny (2009), Mathematical Techniques in Finance (2nd ed.), % Princeton University Press. The original version is available from % http://www.martingales.info/mtfweb2". % A similar acknowledgement should appear prominently inside your written % report. clc; gama=5; V0 = 100; y = 10; rsafe = 0.02; v = (1+rsafe)*V0+y; r = -0.35 : 0.05 : 0.90; % row vector of rates of return from -35% to 90% in 5% increments% XDistr = [0.011 % relative frequency of annual real returns on NIKKEI 225, monthly data 1960-2000 0.023 0.021 0.041 0.034 0.061 0.112 0.095 0.097 0.081 0.091 0.068 0.074 0.049 0.047 0.028 0.015 0.008 0.013 0.021 0.000 0.000 0.004 0.000 0.002 0.004 ]'; CEqTolerance = 10^(-7); X=r-rsafe; EX = X*XDistr'; OmegaX = (X.*XDistr)*X'; betaQU = OmegaX\EX; %****************************% % main body of the programme % %****************************% RR=5; %coefficient of local relative risk aversion [IP,beta]=HARAmax(X,XDistr,gama,CEqTolerance); clc disp('_________________________________________________________________________') disp(' ') disp(sprintf(' gamma = %1d',gama)) disp(' ') disp(sprintf(' Actual risky investment (JPY million) %12.1f', beta/RR*v)) disp(' ') disp(sprintf(' Normalized optimal investment %12.3f', beta)) disp(' ') disp(' ') disp(' quadratic utility (gamma = -1) ') disp(' ') disp(' ') disp(sprintf(' Actual risky investment (JPY million) %12.1f', betaQU/RR*v)) disp(' ') disp(sprintf(' Normalized optimal investment %12.3f', betaQU)) disp(' ') disp('__________________________________________________________________________') disp(' ') disp(' ') disp(' ')