From af8c48a478d187bcf8a8f5cf876ea8f176699542 Mon Sep 17 00:00:00 2001 From: francois Date: Sun, 6 Jul 2014 22:57:57 -0400 Subject: [PATCH] ajout Heston Normal --- R/pnormapproxEsscherLM.R | 4 ++-- R/psaddleapproxEsscherGAL.R | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/R/pnormapproxEsscherLM.R b/R/pnormapproxEsscherLM.R index b4d1c68..659cc52 100644 --- a/R/pnormapproxEsscherLM.R +++ b/R/pnormapproxEsscherLM.R @@ -20,8 +20,8 @@ #' @author Francois Pelletier pnormapproxEsscherLM <- function(x,param,hEsscher=0,eval.time=1,type="mu",log=FALSE,start=0) { - pnorm(x,start+eval.time*(mGAL(1,param,type,log)+hEsscher*cmGAL(2,param,type,log)), - sqrt(eval.time*cmGAL(2,param,type,log))) + pnorm(x,start+eval.time*(mGAL(param,1,type,log)+hEsscher*cmGAL(param,2,type,log)), + sqrt(eval.time*cmGAL(param,2,type,log))) } diff --git a/R/psaddleapproxEsscherGAL.R b/R/psaddleapproxEsscherGAL.R index 4de264e..7522f8d 100644 --- a/R/psaddleapproxEsscherGAL.R +++ b/R/psaddleapproxEsscherGAL.R @@ -22,13 +22,9 @@ psaddleapproxEsscherGAL <- function(x,param,eval.time=1,type="mu",log=FALSE) u <- s * sqrt(diffcgfEsscherGAL(s,2,param,eval.time,type,log)) w <- sign(s)*sqrt(2*(s*x-cgfEsscherGAL(s,param,type,log))) - if(x==mGAL(1,param,type,log)) - { - return(1/2 + diffcgfEsscherGAL(0,3,param,eval.time,type,log)/ + (x==round(mGAL(param,1,type,log),4))* + (1/2 + diffcgfEsscherGAL(0,3,param,eval.time,type,log)/ (6*sqrt(2*pi)*diffcgfEsscherGAL(0,2,param,eval.time,type,log)^(3/2))) - } - else - { - return(pnorm(w)+dnorm(w)*(1/w-1/u)) - } + +(x!=round(mGAL(param,1,type,log),4)) * (pnorm(w)+dnorm(w)*(1/w-1/u)) + } \ No newline at end of file