3

I have some data and I want to fit a Generalized Extreme Value (GEV) distribution using extRemes package in R. However, an error occurs:

library(extRemes)
Mydata = c(6,3,3,3,5,5,4,3,5,5,4,3,4,4,6,5,5,4,5,2,6,4,6,5,3,3,8,3,4,4,6,6,6,6,6,5,6,6,5,5)
fit_gev <- fevd(x=Mydata, method = "MLE", type="GEV", period.basis = "year")
summary(fit_gev)

Error in diag(cov.theta) : invalid 'nrow' value (too large or NA)
In addition: Warning message:
In diag(cov.theta) : NAs introduced by coercion

I wonder how can I fix this error? Thanks for any help.

Yang Yang
  • 858
  • 3
  • 26
  • 49

1 Answers1

2

You could adjust using the EnvStats package as follows:

library(EnvStats)
# Data
Mydata =
c(6,3,3,3,5,5,4,3,5,5,4,3,4,4,6,5,5,4,5,2,6,4,6,5,3,3,8,3,4,4,6,6,6,6,6,5,6,6,5,5)    
# Generalized Extreme Value (EnvStats)
egevd(Mydata, method = "pwme")# (Method: probability-weighted moments)

Results of Distribution Parameter Estimation
--------------------------------------------

Assumed Distribution:            Generalized Extreme Value

Estimated Parameter(s):          location = 4.268896
                                 scale    = 1.314489
                                 shape    = 0.353434

Estimation Method:               Unbiased pwme

Data:                            Mydata

Sample Size:                     40
Marcel
  • 147
  • 4