I have to fit a Variance Gamma distribution to a data set (S&P500 returns), to find the 4 parameters of this distribution i have used the VarianceGamma package but i think that my results aren't correct.
library(VarianceGamma)
# import S&P500 prices from CSV
sp500prices <- read.csv("HistoricalDatasp500.csv")
# calculate the log return of S&P500
n <- nrow(sp500prices)
sp500lret <- log(sp500prices[2:n,2]/sp500prices[1:(n-1),2])
# fit the variance gamma distribution to the log return
vgFit(sp500lret, plots = T)
As you can see in the image that the function vgFit outputs automatically the line is "broken" in several points (it dosent seem to be a probability density function of a variance gamma).
I have also tried the method of moments to find the starting parameter of the optimization but the function gives me error
I saw that other peoples have used the ghyp package but i do not know how to use it properly (not that I’m an expert on the VarianceGamma one) maybe someone can explain it in a simple way