/* ** ********************************************************************* ** ** Version 20/06/04 KCDN (QFE 2nd edition) ** --------------------- ** ** How much you pay to avoid a fair bet ? ** Certainty equivalent for power utility is the solution for xx from: ** ** (C-xx)^(1-gam) = 1/2/ { (c+y)^1-gam + (c-y)^1-gam } ** ********************************************************************* */ new; cls ; screen off ; format /m1/rd 10,4 ; outwidth 255 ; output on ; @ ------------------------- True values of parameters ----------------------- @ gam = 2|10|50|100|250 ; @ --- alternative crra for power utility --- @ y = 10|100|1000|10000|20000 ; @ --- alternative size of fair bet: prob win = 1/2 --- @ c = 50000 ; @ --------------------------------------------------------------------------- @ w = c + y ; xx = zeros(rows(y),rows(gam) ) ; i =1 ; k = 1 ; do until i > rows(gam) ; z = 1 - ( ( 0.5.*(1+y./c)^(1-gam[i]) +0.5.*(1-y./c)^(1-gam[i]) ) )^(1/(1-gam[i])) ; @ --- xx is the certainty equivalent of the fair bet: i.e. how much you would pay to avoid the bet --- @ xx[.,k] = z.*c ; k = k+1 ; i = i+1 ; endo ; /* ** ***************************************************** ** Output ** ***************************************************** */ screen on ; mask1 = 1~1~1~1~1 ; let fmt1[5,3] = "*.*lf" 32 4 "*.*lf" 13 4 "*.*lf" 13 4 "*.*lf" 13 4 "*.*lf" 13 4 ; run_table1 = gam' ; mask2 = 1~1~1~1~1~1~1 ; let fmt2[7,3] = "*.*lf" 4 0 "*.*lf" 15 4 "*.*lf" 13 4 "*.*lf" 13 4 "*.*lf" 13 4 "*.*lf" 13 4 "*.*lf" 13 4 ; run_table2 = seqa(1,1,rows(y))~y~xx ; print " How Much Should One Pay For a Fair Bet ? " ; print " ======================================== " ; print ; print ; print " Amount of the " ; print " fair bet Rows of gam " ; print " ------------------------------------------------------------------------------------ "; call printfm(run_table1, mask1, fmt1) ; print ; print " ------------------------------------------------------------------------------------ "; call printfm(run_table2, mask2, fmt2) ; print ; end ;