I have a dataset of S&P500 returns for 16 yrs. When I plot the ECDF of the S&P500 and compare it against the CDF of an equivalent Normal distribution, I can see the existence of Fat Tails in the S&P 500 data. The code is as below:-
library(quantmod) # Loading quantmod library
getSymbols("^GSPC", from = as.character(Sys.Date()-365*16)) # SPX price date for 16 yrs
SPX <- dailyReturn(GSPC)
SPX_ecdf <- ecdf(as.numeric(SPX)) # dropping xts class
plot(SPX_ecdf,lwd=2,col="red")# Plotting the empirical CDF of S&P500
SPX_mean <- mean(as.numeric(SPX))
SPX_sd <- sd(as.numeric(SPX))
xseq<-seq(-4,4,.01)
cumulative<-pnorm(xseq, mean=SPX_mean, sd=SPX_sd)
lines(xseq,cumulative,col="blue",lwd=2) #Plotting the CDF of a Normal Distribution
legend(x="topleft",c("Empirical CDF of S&P 500 Daily returns","CDF of the Normal Distribution"),col=c("red","blue"),lwd=c(2,2))
Now I would like to model the Tail of my data with the help of GPD. Now if I am correct, the shape parameter ($\xi > 0$) and scale parameter ($ \beta> 0$) in order for the Tail to be a Frechet (If it has really fat tails).
Is there a way in R, to test this out and also find the value of these parameters based on my data?
There used to be a package called POT which had a function fitgpd which I believe would have given me my scale and shape parameters. But this package is no longer available. Is anybody aware of a similar function in some other package which gives me the fitted parameters?