I'm fitting a GPD to some univariate variables using the gpd
command from the evir
package. Being a two-parameter distribution family, if I run
gpd(z_b[1:1000], threshold=quantile(z_b[1:1000],0.95), method="ml", information="expected")$par.ests[1]
I obtain the first parameter, the shape parameter xi for observations 1 to 1000.
Since I want to develop a time series model for xi, I wanted to extract the parameter xi for the whole series (total of 4344 observations). My attempt:
xi_b <- array(dim=c(3345,1))
for (i in 1:3345){
xi_b[i]=gpd(z_b[i:i+999], threshold=quantile(z_b[i:i+999], 0.95), method="ml", information="expected")$par.ests[1]
}
As you can see the procedure is the same; I estimate xi using the exceedances over 95% quantile over 1000 observations (so 50 data points), and I want to have 3345 estimates (from 1-1000 to 3345-4344). However, I get the following error:
Error in optim(theta, negloglik, hessian = TRUE, ..., tmp = excess) : valore non finito fornito da optim
where the last sentence could be translated with "value provided by optim not finite".
What is wrong with this, i.e. why does it work with given observations (e.g. 1:1000) but not in the loop example? How can I fix this?
If anyone wants to try I've shared the data for z_b: https://www.dropbox.com/s/fbg04thvvb6x5d8/zb.txt?dl=0