From 0c637960412f09ed7734feaa36dcacab26a2d337 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Wed, 6 Nov 2024 16:58:52 +0100 Subject: [PATCH] Edit Exercise11.rmd --- M1/Monte Carlo Methods/Exercise11.rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/M1/Monte Carlo Methods/Exercise11.rmd b/M1/Monte Carlo Methods/Exercise11.rmd index 547118e..82b4b48 100644 --- a/M1/Monte Carlo Methods/Exercise11.rmd +++ b/M1/Monte Carlo Methods/Exercise11.rmd @@ -17,7 +17,7 @@ h <- function(x, a) { x >= a } -G <- function(x, a, k) { +G_inv <- function(x, a, k) { a / (1 - x)^(1 / k) } @@ -26,7 +26,7 @@ x1 <- rcauchy(n, 0, 1) p1 <- h(x1, a) # Importance sampling -x2 <- G(runif(n), a, k) +x2 <- G_inv(runif(n), a, k) p2 <- f(x2) / g(x2, a, k) * h(x2, a) # Results (cat the results and the var of the estimators)