% Copyright (c) 2001-2009 by Ales Cerny %************************************************************************% % chapter4sect3.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 chapter4sect3.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. % One period optimal investment with CRRA utility, incomplete markets, % single risky asset Japanese NIKKEI 225 real return data,year on year % returns, monthly data 1960-2000. clear; clc; %*******************% % parameters % %*******************% % row vector of rates of return from -35% to 90% in 5% increments Risky1 = -0.35 : 0.05 : 0.90; RiskFreeRate = 0.02; %****************************************% % global parameters for utility % % maximizing procedure CRRAmax % %****************************************% outputflag = 1; gama=5; CEqTol=10^-5; % relative frequency of annual real returns on NIKKEI 225 XDistr = [0.011 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 ]; X = Risky1-RiskFreeRate; %*********************************************% % Computations for quadratic utility investor % %*********************************************% EX = X*XDistr'; % E[X] EX2 = X.^2*XDistr'; % E[X^2] %****************************% % main body of the programme % %****************************% [CE,alpha] = CRRAmax(X, XDistr, gama, CEqTol, outputflag) ; disp(' '); disp(sprintf('Certainty equivalent wealth/Safe wealth %12.4f ', CE)); disp(sprintf('CRRA alpha %12.4f ', alpha)); disp(sprintf('quadratic utility alpha %12.4f ', EX/EX2/gama)); disp('');