I'm trying to adjust a GEV Distribution to a dataset, using the "fitdistr" function from "fitdistrplus" package. I'm also having trouble in the interpretation of the p-value result for another dataset. The "chisqpvalue" from "gofstat" function is returning a null vector.
Thank you very much in advance.
I tried the following script:
library(fitdistrplus)
library(evd)
x <- c(11, 6, 3, 3, 4, 4, 5, 9, 4, 16, 8, 9, 7, 8, 16, 11, 5, 8, 9, 4, 17, 6, 7, 7, 6, 6)
par <- list(loc = 0.0, scale = 1.0, shape = 0)
fitX <- fitdist(abs(x), "gev",start=par)
resultX <- gofstat(fitX)
It's returning the following message: the function mle failed to estimate the parameters, with the error code 100
When i remove some values from the dataset, it runs withour error:
x <- c(11, 6, 3, 3, 5, 9, 4, 16, 8, 9, 7, 8, 16, 11, 5, 8, 9, 4, 17, 6, 7, 7, 6, 6)
par <- list(loc = 0.0, scale = 1.0, shape = 0)
fitX <- fitdist(abs(x), "gev",start=par)
resultX <- gofstat(fitX)
I think the problem could be the starting parameters that i've choose. But, there is a correct way to estimate it?
Another problem of mine is about the p-value resuits. In the example below (another dataset), the code is running, fitting the GEV distribution, but the p-value(chisqpvalue) result is Null
x <- c(10, 21, 7, 17, 18, 16, 17, 12, 22, 19, 12, 49, 11, 9)
par <- list(loc = 0.0, scale = 1.0, shape = 0)
fitX <- fitdist(abs(x), "gev",start=par)
resultX <- gofstat(fitX)
Using
bbmle::mle2, which is a little more flexible and lets us fit the scale parameter on the log scale so we can stay out of trouble:Using these starting values is good enough to let
fitdistsucceed: