-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further docs tidying, bringing opre_l up to date and also improving r…
…eferences to literature with DOI links etc
- Loading branch information
1 parent
d23e5ce
commit fe50621
Showing
8 changed files
with
65 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
#' Financial options using a Milstein discretisation | ||
#' | ||
#' Financial options based on scalar geometric Brownian motion, similar to Mike Giles' MCQMC06 paper, using a Milstein discretisation. | ||
#' Financial options based on scalar geometric Brownian motion, similar to Mike Giles' MCQMC06 paper, Giles (2008), using a Milstein discretisation. | ||
#' | ||
#' This function is based on GPL-2 C++ code by Mike Giles. | ||
#' | ||
|
@@ -26,7 +26,7 @@ | |
#' @author Mike Giles <[email protected]> | ||
#' | ||
#' @references | ||
#' M.B. Giles. 'Improved multilevel Monte Carlo convergence using the Milstein scheme', p.343-358 in \emph{Monte Carlo and Quasi-Monte Carlo Methods 2006}, Springer, 2007. | ||
#' Giles, M. (2008) 'Improved Multilevel Monte Carlo Convergence using the Milstein Scheme', in A. Keller, S. Heinrich, and H. Niederreiter (eds) \emph{Monte Carlo and Quasi-Monte Carlo Methods 2006}. Berlin, Heidelberg: Springer, pp. 343–358. Available at: \url{https://doi.org/10.1007/978-3-540-74496-2_20}. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,11 +27,11 @@ | |
#' @author Tigran Nagapetyan <[email protected]> | ||
#' | ||
#' @references | ||
#' M.B. Giles. Multilevel Monte Carlo path simulation. \emph{Operations Research}, 56(3):607-617, 2008. | ||
#' Giles, M.B. (2008) 'Multilevel Monte Carlo Path Simulation', \emph{Operations Research}, 56(3), pp. 607–617. Available at: \url{https://doi.org/10.1287/opre.1070.0496}. | ||
#' | ||
#' M.B. Giles. Multilevel Monte Carlo methods. \emph{Acta Numerica}, 24:259-328, 2015. | ||
#' Giles, M.B. (2015) 'Multilevel Monte Carlo methods', \emph{Acta Numerica}, 24, pp. 259–328. Available at: \url{https://doi.org/10.1017/S096249291500001X}. | ||
#' | ||
#' S. Heinrich. Monte Carlo complexity of global solution of integral equations. \emph{Journal of Complexity}, 14(2):151-175, 1998. | ||
#' Heinrich, S. (1998) 'Monte Carlo Complexity of Global Solution of Integral Equations', \emph{Journal of Complexity}, 14(2), pp. 151–175. Available at: \url{https://doi.org/10.1006/jcom.1998.0471}. | ||
#' | ||
#' @param Lmin | ||
#' the minimum level of refinement. Must be \eqn{\ge 2}. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ mu <- function(x, h) { | |
|
||
#' Financial options using an Euler-Maruyama discretisation | ||
#' | ||
#' Financial options based on scalar geometric Brownian motion and Heston models, similar to Mike Giles' original 2008 Operations Research paper, using an Euler-Maruyama discretisation | ||
#' Financial options based on scalar geometric Brownian motion and Heston models, similar to Mike Giles' original 2008 Operations Research paper, Giles (2008), using an Euler-Maruyama discretisation | ||
#' | ||
#' This function is based on GPL-2 'Matlab' code by Mike Giles. | ||
#' | ||
|
@@ -39,7 +39,7 @@ mu <- function(x, h) { | |
#' @author Tigran Nagapetyan <[email protected]> | ||
#' | ||
#' @references | ||
#' M.B. Giles. Multilevel Monte Carlo path simulation. \emph{Operations Research}, 56(3):607-617, 2008. | ||
#' Giles, M.B. (2008) 'Multilevel Monte Carlo Path Simulation', \emph{Operations Research}, 56(3), pp. 607–617. Available at: \url{https://doi.org/10.1287/opre.1070.0496}. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
|
@@ -53,60 +53,66 @@ mu <- function(x, h) { | |
#' # -- the new MLMC driver is a little different | ||
#' # -- switch to X_0=100 instead of X_0=1 | ||
#' | ||
#' M <- 4 # refinement cost factor | ||
#' N0 <- 1000 # initial samples on coarse levels | ||
#' Lmin <- 2 # minimum refinement level | ||
#' Lmax <- 6 # maximum refinement level | ||
#' | ||
#' test.res <- list() | ||
#' for(option in 1:5) { | ||
#' if(option==1) { | ||
#' if(option == 1) { | ||
#' cat("\n ---- Computing European call ---- \n") | ||
#' N <- 2000000 # samples for convergence tests | ||
#' N <- 1000000 # samples for convergence tests | ||
#' L <- 5 # levels for convergence tests | ||
#' Eps <- c(0.005, 0.01, 0.02, 0.05, 0.1) | ||
#' } else if(option==2) { | ||
#' } else if(option == 2) { | ||
#' cat("\n ---- Computing Asian call ---- \n") | ||
#' N <- 2000000 # samples for convergence tests | ||
#' N <- 1000000 # samples for convergence tests | ||
#' L <- 5 # levels for convergence tests | ||
#' Eps <- c(0.005, 0.01, 0.02, 0.05, 0.1) | ||
#' } else if(option==3) { | ||
#' } else if(option == 3) { | ||
#' cat("\n ---- Computing lookback call ---- \n") | ||
#' N <- 2000000 # samples for convergence tests | ||
#' N <- 1000000 # samples for convergence tests | ||
#' L <- 5 # levels for convergence tests | ||
#' Eps <- c(0.01, 0.02, 0.05, 0.1, 0.2) | ||
#' } else if(option==4) { | ||
#' } else if(option == 4) { | ||
#' cat("\n ---- Computing digital call ---- \n") | ||
#' N <- 3000000 # samples for convergence tests | ||
#' N <- 4000000 # samples for convergence tests | ||
#' L <- 5 # levels for convergence tests | ||
#' Eps <- c(0.02, 0.05, 0.1, 0.2, 0.5) | ||
#' } else if(option==5) { | ||
#' } else if(option == 5) { | ||
#' cat("\n ---- Computing Heston model ---- \n") | ||
#' N <- 2000000 # samples for convergence tests | ||
#' L <- 5 # levels for convergence tests | ||
#' Eps <- c(0.005, 0.01, 0.02, 0.05, 0.1) | ||
#' } | ||
#' | ||
#' test.res[[option]] <- mlmc.test(opre_l, M, N, L, N0, Eps, Lmin, Lmax, option=option) | ||
#' test.res[[option]] <- mlmc.test(opre_l, N, L, N0, Eps, Lmin, Lmax, option = option) | ||
#' | ||
#' # print exact analytic value, based on S0=K | ||
#' T <- 1 | ||
#' r <- 0.05 | ||
#' sig <- 0.2 | ||
#' K <- 100 | ||
#' | ||
#' k <- 0.5*sig^2/r; | ||
#' d1 <- (r+0.5*sig^2)*T / (sig*sqrt(T)) | ||
#' d2 <- (r-0.5*sig^2)*T / (sig*sqrt(T)) | ||
#' | ||
#' if(option==1) { | ||
#' if(option == 1) { | ||
#' val <- K*( pnorm(d1) - exp(-r*T)*pnorm(d2) ) | ||
#' cat(sprintf("\n Exact value: %f, MLMC value: %f \n", val, test.res[[option]]$P[1])) | ||
#' } else if(option==3) { | ||
#' k <- 0.5*sig^2/r | ||
#' } else if(option == 2) { | ||
#' val <- NA | ||
#' } else if(option == 3) { | ||
#' val <- K*( pnorm(d1) - pnorm(-d1)*k - exp(-r*T)*(pnorm(d2) - pnorm(d2)*k) ) | ||
#' cat(sprintf("\n Exact value: %f, MLMC value: %f \n", val, test.res[[option]]$P[1])) | ||
#' } else if(option==4) { | ||
#' } else if(option == 4) { | ||
#' val <- K*exp(-r*T)*pnorm(d2) | ||
#' } else if(option == 5) { | ||
#' val <- NA | ||
#' } | ||
#' | ||
#' if(is.na(val)) { | ||
#' cat(sprintf("\n Exact value unknown, MLMC value: %f \n", test.res[[option]]$P[1])) | ||
#' } else { | ||
#' cat(sprintf("\n Exact value: %f, MLMC value: %f \n", val, test.res[[option]]$P[1])) | ||
#' } | ||
#' | ||
|
@@ -116,7 +122,7 @@ mu <- function(x, h) { | |
#' } | ||
#' | ||
#' # The level sampler can be called directly to retrieve the relevant level sums: | ||
#' opre_l(l=7, N=10, option=1) | ||
#' opre_l(l = 7, N = 10, option = 1) | ||
#' | ||
#' @importFrom stats rnorm | ||
#' @export | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ using namespace Rcpp; | |
|
||
//' Financial options using a Milstein discretisation | ||
//' | ||
//' Financial options based on scalar geometric Brownian motion, similar to Mike Giles' MCQMC06 paper, using a Milstein discretisation. | ||
//' Financial options based on scalar geometric Brownian motion, similar to Mike Giles' MCQMC06 paper, Giles (2008), using a Milstein discretisation. | ||
//' | ||
//' This function is based on GPL-2 C++ code by Mike Giles. | ||
//' | ||
|
@@ -31,7 +31,7 @@ using namespace Rcpp; | |
//' @author Mike Giles <[email protected]> | ||
//' | ||
//' @references | ||
//' M.B. Giles. 'Improved multilevel Monte Carlo convergence using the Milstein scheme', p.343-358 in \emph{Monte Carlo and Quasi-Monte Carlo Methods 2006}, Springer, 2007. | ||
//' Giles, M. (2008) 'Improved Multilevel Monte Carlo Convergence using the Milstein Scheme', in A. Keller, S. Heinrich, and H. Niederreiter (eds) \emph{Monte Carlo and Quasi-Monte Carlo Methods 2006}. Berlin, Heidelberg: Springer, pp. 343–358. Available at: \url{https://doi.org/10.1007/978-3-540-74496-2_20}. | ||
//' | ||
//' @examples | ||
//' \dontrun{ | ||
|