GeneralizedAsymmetricLaplace/R/cfGAL.R

45 lines
1.1 KiB
R
Raw Normal View History

2014-01-03 02:17:20 +00:00
# Characteristic function of GAL distribution
#
# Author: Francois Pelletier
#
# LGPL 3.0
###############################################################################
#' Characteristic function of GAL distribution
#' @param u Transform variate
#' @param param Parameter vector
#' @param type Choose between "mu" or "kappa" parametrization
2014-01-03 04:43:57 +00:00
#' @param log Logical for log-parameters
2014-01-03 02:17:20 +00:00
#' @return Characteristic function value at point u for given parameter vector
#' @export cfGAL
2014-01-03 02:17:20 +00:00
#' @author Francois Pelletier
2014-01-03 04:43:57 +00:00
cfGAL <- function(u,param,type="mu",log=FALSE)
2014-01-03 02:17:20 +00:00
{
2014-01-04 18:02:45 +00:00
testparGAL(param,type,log)
2014-01-03 02:17:20 +00:00
if(log)
{
if(type=="mu")
{
return(exp(1i*exp(param[1])*u)*(1+(exp(param[2])^2*u^2)/2-1i*exp(param[3])*u)^(-exp(param[4])))
2014-01-03 02:17:20 +00:00
}
if(type=="kappa")
{
return(exp(1i*exp(param[1])*u)*(1+(exp(param[2])^2*u^2)/2-(1/2*1i)*
exp(param[2])*sqrt(2)*(1/exp(param[3])-exp(param[3]))*u)^(-exp(param[4])))
2014-01-03 02:17:20 +00:00
}
}
else
{
if(type=="mu")
{
return(exp(1i*param[1]*u)*(1+(param[2]^2*u^2)/2-1i*param[3]*u)^(-param[4]))
2014-01-03 02:17:20 +00:00
}
if(type=="kappa")
{
return(exp(1i*param[1]*u)*(1+(param[2]^2*u^2)/2-(1/2*1i)*
param[2]*sqrt(2)*(1/param[3]-param[3])*u)^(-param[4]))
2014-01-03 02:17:20 +00:00
}
}
}