Solved – Calculating confidence interval of return period

confidence interval

I have a time series of annual rainfall data and I wish to calculate the return period curve for this data. To do this, I have used Matlab to fit a gamma distribution, and then used the Lilliefors test to test the distribution fit. If I cannot reject the null hypothesis at the 5% level, I will use the fitted gamma distribution to calculate the return period. I have done this fine, but what I need to do is calculate the confidence interval for this return period curve.

How do I go about doing this? I am not a statistician, so I am struggling to understand a lot of the information I have found online about how to do this. If anyone can explain it to me quite simply, that would be great! I appreciate there may be inbuilt ways of doing this in Matlab, but I need to understand the process behind it so I can write it up in my thesis.

This image is an example of what I want to produce.

enter image description here
This is done using the extRemes package for R, but I want to recreate this myself as the package doesn't use the gamma distribution to do the fitting. I think this figures uses the GEV distribution. I have currently reproduced the black line (the return period curve calculated after fitting the gamma distribution) from my data, but I don't know how to do the blue lines (the confidence interval).

Best Answer

You can get confidence intervals for the CDF. So if the quantity of interest is a function of the CDF, you could use those intervals. Here's an example:

x = gamrnd(100,1.3,100,1);
d = fitdist(x,'gamma')
grid = linspace(50,200)';
[y,ylo,yhi] = cdf(d,grid);
plot(grid,y,'b-',grid,ylo,'b:',grid,yhi,'b:')
Related Question