ajout parametre Esscher manquant

This commit is contained in:
Francois Pelletier 2014-07-27 19:02:08 -04:00
parent af8c48a478
commit 374454aa03
3 changed files with 23 additions and 9 deletions

View file

@ -14,6 +14,5 @@
<natures>
<nature>de.walware.statet.base.StatetNature</nature>
<nature>de.walware.statet.r.RNature</nature>
<nature>de.walware.statet.r.RPkgNature</nature>
</natures>
</projectDescription>

View file

@ -1,5 +1,5 @@
# Cumulant generating function of the
# Esscher transform with parameter 1 of GAL distribution
# Esscher transform of GAL distribution
#
# Author: Francois Pelletier
#
@ -11,22 +11,37 @@
#' Esscher transform with parameter 1 of GAL distribution
#' @param u Transform variate
#' @param param Parameter vector
#' @param ess.param Esscher Transform Parameter
#' @param eval.time Time of the process
#' @param type Choose between "mu" or "kappa" parametrization
#' @param log Logical for log-parameters
#' @return Cumulant generating function value at point u for given parameter vector
#' @export cgfEsscherGAL
#' @author Francois Pelletier
cgfEsscherGAL <- function(u,param,eval.time=1,type="mu",log=FALSE)
cgfEsscherGAL <- function(u,param,ess.param=1,eval.time=1,type="mu",log=FALSE)
{
if(type=="mu")
testparGAL(param,type,log)
if(log)
{
return(log((exp(param[1]*(u+1))/(1-(1/2)*param[2]^2*(u+1)^2-param[3]*(u+1))^param[4])^eval.time/
(exp(param[1])/(1-(1/2)*param[2]^2-param[3])^param[4])^eval.time))
if(type=="mu")
{
return(log(exp(exp(param[1])*(u+ess.param))*(1-(1/2)*exp(param[2])^2*(u+ess.param)^2-exp(param[3])*(u+ess.param))^(-exp(param[4]))))
}
if(type=="kappa")
{
return(log(exp(exp(param[1])*(u+ess.param))*((exp(param[2])^2*(u+ess.param)^2)/2+(exp(param[3])*exp(param[2])*(u+ess.param))/sqrt(2)-(exp(param[2])*(u+ess.param))/(sqrt(2)*exp(param[3]))+1)^(-exp(param[4]))))
}
}
if(type=="kappa")
else
{
if(type=="mu")
{
return(log(exp(param[1]*(u+ess.param))*(1-(1/2)*param[2]^2*(u+ess.param)^2-param[3]*(u+ess.param))^(-param[4])))
}
if(type=="kappa")
{
return(log(exp(param[1]*(u+ess.param))*((param[2]^2*(u+ess.param)^2)/2+(param[3]*param[2]*(u+ess.param))/sqrt(2)-(param[2]*(u+ess.param))/(sqrt(2)*param[3])+1)^(-param[4])))
}
}
}

View file

@ -20,7 +20,7 @@ psaddleapproxEsscherGAL <- function(x,param,eval.time=1,type="mu",log=FALSE)
{
s <- saddlepointEsscherGAL(x,param,eval.time,type,log)
u <- s * sqrt(diffcgfEsscherGAL(s,2,param,eval.time,type,log))
w <- sign(s)*sqrt(2*(s*x-cgfEsscherGAL(s,param,type,log)))
w <- sign(s)*sqrt(2*(s*x-cgfEsscherGAL(s,param,1,eval.time,type,log)))
(x==round(mGAL(param,1,type,log),4))*
(1/2 + diffcgfEsscherGAL(0,3,param,eval.time,type,log)/