This function computes and plots confidence intervals around the estimated average price, as functions of the number of simulations.
esgmccv(r, X, maturity, plot = TRUE, ...)
a numeric
or a time series object, the risk-free rate(s).
asset prices obtained with simdiff
the corresponding maturity (optional). If missing, all the maturities
available in X
are used.
if TRUE
(default), a plot of the convergence is displayed.
additional parameters provided to matplot
a list with estimated average prices and the confidence intervals around them.
Studying the convergence of the sample mean of :
$$E[X_T exp(-\int_0^T r_s ds)]$$
towards its true value.
r <- 0.03
set.seed(1)
eps0 <- simshocks(n = 100, horizon = 5, frequency = "quart")
sim.GBM <- simdiff(n = 100, horizon = 5, frequency = "quart",
model = "GBM",
x0 = 100, theta1 = 0.03, theta2 = 0.1,
eps = eps0)
# monte carlo prices
esgmcprices(r, sim.GBM)
#> Qtr1 Qtr2 Qtr3 Qtr4
#> 0 100.00000 99.87926 100.28263 100.27294
#> 1 100.74803 100.35236 100.78660 100.60459
#> 2 100.59029 101.37518 102.10043 103.19092
#> 3 102.51163 103.12298 102.69882 102.83572
#> 4 102.67107 103.13669 102.80105 102.34260
#> 5 102.40749
# convergence to a specific price
(esgmccv(r, sim.GBM, 2))
#> $avg.price
#> [1] 94.18180 94.52128 93.57814 97.08570 94.08274 94.73565 92.26875
#> [8] 94.18546 94.54242 95.65661 95.99182 95.97286 97.04628 97.62135
#> [15] 96.25142 96.87029 97.28030 97.85751 98.04523 97.54134 98.80124
#> [22] 98.92261 99.64998 100.40902 99.60475 100.16003 100.10753 100.09967
#> [29] 99.63650 99.31339 99.16772 99.09841 99.40427 99.17911 98.64973
#> [36] 98.32701 99.07733 99.40902 99.10501 99.66872 99.33878 99.64501
#> [43] 99.68267 99.65628 99.79480 99.97476 99.86859 99.84431 100.01467
#> [50] 99.89754 100.25802 99.96374 100.06441 100.08514 99.92699 100.02655
#> [57] 99.95614 99.81390 99.76395 99.90546 99.67873 99.78623 100.10851
#> [64] 99.70193 99.55514 99.90090 99.67199 100.04796 100.06902 100.20049
#> [71] 100.46180 100.23653 100.34795 100.54216 100.61190 100.54650 100.88753
#> [78] 100.88647 100.70495 100.73819 101.19328 101.09990 101.12936 101.02788
#> [85] 101.00752 100.71631 100.66814 100.61243 100.70712 100.76150 100.80013
#> [92] 100.72378 100.62133 100.57805 100.53019 100.44582 100.52888 100.52104
#> [99] 100.59029
#>
#> $conf.int
#> lower bound upper bound
#> [1,] -91.00367 279.3673
#> [2,] 58.28698 130.7556
#> [3,] 74.39103 112.7653
#> [4,] 80.86960 113.3018
#> [5,] 79.59609 108.5694
#> [6,] 82.97223 106.4991
#> [7,] 80.82552 103.7120
#> [8,] 83.39672 104.9742
#> [9,] 85.04178 104.0431
#> [10,] 86.83564 104.4776
#> [11,] 88.00340 103.9802
#> [12,] 88.69849 103.2472
#> [13,] 89.97734 104.1152
#> [14,] 90.97258 104.2701
#> [15,] 89.41571 103.0871
#> [16,] 90.35067 103.3899
#> [17,] 91.10194 103.4587
#> [18,] 91.91300 103.8020
#> [19,] 92.41326 103.6772
#> [20,] 92.09984 102.9828
#> [21,] 93.00302 104.5995
#> [22,] 93.39178 104.4534
#> [23,] 94.15780 105.1422
#> [24,] 94.92472 105.8933
#> [25,] 94.09200 105.1175
#> [26,] 94.74407 105.5760
#> [27,] 94.89685 105.3182
#> [28,] 95.08025 105.1191
#> [29,] 94.70300 104.5700
#> [30,] 94.50310 104.1237
#> [31,] 94.50700 103.8284
#> [32,] 94.58463 103.6122
#> [33,] 94.98642 103.8221
#> [34,] 94.86976 103.4885
#> [35,] 94.33037 102.9691
#> [36,] 94.07945 102.5746
#> [37,] 94.67603 103.4786
#> [38,] 95.07355 103.7445
#> [39,] 94.83832 103.3717
#> [40,] 95.35746 103.9800
#> [41,] 95.08214 103.5954
#> [42,] 95.44582 103.8442
#> [43,] 95.58215 103.7832
#> [44,] 95.65020 103.6624
#> [45,] 95.86930 103.7203
#> [46,] 96.11895 103.8306
#> [47,] 96.09009 103.6471
#> [48,] 96.14543 103.5432
#> [49,] 96.37629 103.6530
#> [50,] 96.32527 103.4698
#> [51,] 96.68280 103.8332
#> [52,] 96.40888 103.5186
#> [53,] 96.57173 103.5571
#> [54,] 96.65777 103.5125
#> [55,] 96.54789 103.3061
#> [56,] 96.70260 103.3505
#> [57,] 96.68823 103.2241
#> [58,] 96.59045 103.0373
#> [59,] 96.59425 102.9337
#> [60,] 96.77641 103.0345
#> [61,] 96.56838 102.7891
#> [62,] 96.71911 102.8533
#> [63,] 97.02270 103.1943
#> [64,] 96.55815 102.8457
#> [65,] 96.44642 102.6639
#> [66,] 96.76293 103.0389
#> [67,] 96.54779 102.7962
#> [68,] 96.88008 103.2158
#> [69,] 96.94727 103.1908
#> [70,] 97.11264 103.2883
#> [71,] 97.37363 103.5500
#> [72,] 97.15875 103.3143
#> [73,] 97.30464 103.3912
#> [74,] 97.51555 103.5688
#> [75,] 97.62281 103.6010
#> [76,] 97.59425 103.4988
#> [77,] 97.89589 103.8792
#> [78,] 97.93355 103.8394
#> [79,] 97.76745 103.6425
#> [80,] 97.83699 103.6394
#> [81,] 98.18854 104.1980
#> [82,] 98.12633 104.0735
#> [83,] 98.19134 104.0674
#> [84,] 98.11814 103.9376
#> [85,] 98.13203 103.8830
#> [86,] 97.81617 103.6165
#> [87,] 97.80001 103.5363
#> [88,] 97.77500 103.4498
#> [89,] 97.89554 103.5187
#> [90,] 97.97932 103.5437
#> [91,] 98.04770 103.5526
#> [92,] 97.99728 103.4503
#> [93,] 97.91671 103.3259
#> [94,] 97.90105 103.2551
#> [95,] 97.87988 103.1805
#> [96,] 97.81799 103.0737
#> [97,] 97.92312 103.1346
#> [98,] 97.94202 103.1001
#> [99,] 98.03382 103.1468
#>