Background: I have a sample which I want to model with a heavy tailed distribution. I have some extreme values, such that the spread of the observations are relatively large. My idea was to model this with a generalized Pareto distribution, and so I have done. Now, the 0.975 quantile of my empirical data (about 100 datapoints) is lower than the 0.975 quantile of the Generalized Pareto distribution that I fitted to my data. Now, I thought, is there some way to check if this difference is something to worry about?
We know that the asymptotic distribution of the quantiles are given as:
So I thought that it would be a good idea to entertain my curiosity by trying to plot the 95% confidence bands around the 0.975 quantile of a generalized Pareto distribution with the same parameters as I got from the fitting of my data.
As you see, we are working with some extreme values here. And since the spread is so enormous, the density function has extremely small values, making the confidence bands go to the order of $\pm 10^{12}$ using the variance of the asymptotic normality formula above:
$\pm 1.96\frac{0.975*0.025}{n({f_{GPD}(q_{0.975})})^2}$
So, this does not make any sense. I have a distribution with only positive outcomes, and the confidence intervals include negative values. So something is going on here. If I calculate the bands around the 0.5 quantile, the bands are not that huge, but still huge.
I proceed to see how this goes with another distribution, namely the $\mathcal{N}(1,1)$ distribution. Simulate $n=100$ observations from a $\mathcal{N}(1,1)$ distribution, and check if the quantiles are within the confidence bands. I do this 10000 times to see the proportions of the 0.975/0.5 quantiles of the simulated observations that are within the confidence bands.
################################################
# Test at the 0.975 quantile
################################################
#normal(1,1)
#find 0.975 quantile
q_norm<-qnorm(0.975, mean=1, sd=1)
#find density value at 97.5 quantile:
f_norm<-dnorm(q_norm, mean=1, sd=1)
#confidence bands absolute value:
band=1.96*sqrt((0.975*0.025)/(100*(f_norm)^2))
u=q_norm+band
l=q_norm-band
hit<-1:10000
for(i in 1:10000){
d<-rnorm(n=100, mean=1, sd=1)
dq<-quantile(d, probs=0.975)
if(dq[[1]]>=l & dq[[1]]<=u) {hit[i]=1} else {hit[i]=0}
}
sum(hit)/10000
#################################################################3
# Test at the 0.5 quantile
#################################################################
#using lower quantile:
#normal(1,1)
#find 0.7 quantile
q_norm<-qnorm(0.7, mean=1, sd=1)
#find density value at 0.7 quantile:
f_norm<-dnorm(q_norm, mean=1, sd=1)
#confidence bands absolute value:
band=1.96*sqrt((0.7*0.3)/(100*(f_norm)^2))
u=q_norm+band
l=q_norm-band
hit<-1:10000
for(i in 1:10000){
d<-rnorm(n=100, mean=1, sd=1)
dq<-quantile(d, probs=0.7)
if(dq[[1]]>=l & dq[[1]]<=u) {hit[i]=1} else {hit[i]=0}
}
sum(hit)/10000
EDIT: I fixed the code, and both quantiles gives approximately 95% hits with n=100 and with $\sigma=1$. If I crank up the standard deviation to $\sigma=2$, then very few hits are within the bands. So question still stands.
EDIT2: I retract what I claimed in the first EDIT above, as pointed out in the comments by a helpful gentleman. It actually looks like these CI's are good for the normal distribution.
Is this asymptotic normality of the order statistic just a very bad measure to use, if one wants to check if some observed quantile is probable given a certain candidate distribution?
Intuitively, it seems to me like there is a relationship between the variance of the distribution (which one thinks created the data, or in my R example, which we know created the data) and the number of observations. If you have 1000 observations and an enormous variance, these bands are bad. If one has 1000 observations and a small variance, these bands would maybe make sense.
Anybody care to clear this up for me?
band = 1.96*sqrt((0.975*0.025)/(100*n*(f_norm)^2))
, that may help. Sorry I missed that the first time through. (Maybe you fixed this too but haven't updated the relevant parts of the question.) $\endgroup$