The Variance Gamma distribution is a normal variance-mean mixture distribution where the mixing density is the gamma distribution. This distribution contains a skewness and a tail parameter, and it has been employed in many financial applications. The shape parameters (skewness and kurtosis) of this distribution, being a member of the family of the generalysed hyperbolic family, tend to be difficult to estimate. One way to alleviate this problem consists of fixing the skewness parameter to zero, and to alternatively induce asymmetry by using the two-piece construction, since the skewness parameter in this family is easy to estimate. The implementation of the two-piece Variance Gamma distribution is simple by combining the R packages ‘twopiece’ and ‘VarianceGamma’. The extension to the Double two-piece Variance Gamma distribution is also simple using the ‘DTP’ R package, as shown in the R code below.
References.
Inference in Two-Piece Location-Scale Models with Jeffreys Priors.
Bayesian modelling of skewness and kurtosis with Two-Piece Scale and shape distributions.
rm(list=ls())
# Required packages
library(VarianceGamma)
## Loading required package: DistributionUtils
## Loading required package: RUnit
## Loading required package: GeneralizedHyperbolic
library(twopiece)
## Loading required package: flexclust
## Loading required package: grid
## Loading required package: lattice
## Loading required package: modeltools
## Loading required package: stats4
## Loading required package: mvtnorm
## Loading required package: label.switching
library(DTP)
###################################################################################################
# Symmetric Variance Gamma distribution with location zero and scale 1 and kurtosis parameter delta
###################################################################################################
dsvg = function(x,delta=1,log=FALSE){
logPDF <- log(dvg(x, vgC = 0, sigma = 1, theta = 0, nu = delta))
ifelse(is.numeric(logPDF), ifelse(log, return(logPDF), return(exp(logPDF))),
logPDF)
}
# Plot of this density for delta = 0.5, 1.25.
tempf1 = Vectorize(function(x) dsvg(x,0.5))
tempf2 = Vectorize(function(x) dsvg(x,1.25))
curve(tempf1,-5,5,n=1000,ylim=c(0,1),lwd=2,lty=1)
curve(tempf2,-5,5,n=1000,add=T,lwd=2,lty=2)
###################################################################################################
# Two-piece variance gamma distribution with the epsilon-skew parameterisation
###################################################################################################
# Example 1
skewness = 0.5
kurtosis = 0.5
dtpvg= Vectorize(function(x) dtp4(x,0,1,skewness,kurtosis,FUN=dsvg,param="eps"))
curve(dtpvg,-5,5,n=1000,lwd=2)
# Example 2
skewness = 0.5
kurtosis = 1.25
dtpvg= Vectorize(function(x) dtp4(x,0,1,skewness,kurtosis,FUN=dsvg,param="eps"))
curve(dtpvg,-5,5,n=1000,lwd=2)
###################################################################################################
# Double two-piece variance gamma distribution with the epsilon-skew parameterisation
###################################################################################################
# Example 1
skewness = 0.5
kurtosis1 = 0.5
kurtosis2 = 1.25
dtp2vg= Vectorize(function(x) ddtp(x,0,1,skewness,kurtosis1,kurtosis2,f=dsvg,param="eps"))
curve(dtp2vg,-5,5,n=1000,lwd=2)
# Example 2
skewness = 0.5
kurtosis1 = 1.25
kurtosis2 = 0.5
dtp2vg= Vectorize(function(x) ddtp(x,0,1,skewness,kurtosis1,kurtosis2,f=dsvg,param="eps"))
curve(dtp2vg,-5,5,n=1000,lwd=2)