GeneralizedAsymmetricLaplace/R/cgfEsscherGAL.R

49 lines
1.5 KiB
R
Raw Normal View History

# Cumulant generating function of the
2014-07-27 23:02:08 +00:00
# Esscher transform of GAL distribution
#
# Author: Francois Pelletier
#
# LGPL 3.0
###############################################################################
#' Cumulant generating function of the
#' Esscher transform with parameter 1 of GAL distribution
#' @param u Transform variate
#' @param param Parameter vector
2014-07-27 23:02:08 +00:00
#' @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
2014-07-27 23:02:08 +00:00
cgfEsscherGAL <- function(u,param,ess.param=1,eval.time=1,type="mu",log=FALSE)
{
2014-07-27 23:02:08 +00:00
testparGAL(param,type,log)
if(log)
{
2014-07-27 23:02:08 +00:00
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]))))
}
}
2014-07-27 23:02:08 +00:00
else
{
2014-07-27 23:02:08 +00:00
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])))
}
}
}