2

I would need to calculate the parameters of a Fréchet distribution.

I am using the packages fitdistrplus and evd of R. But I don't know what values to initialize the parameters.

library(fitdistrplus)
library(evd)

#Datos
x<-c(19.1,20.2,14.3,19.0,18.8,18.5,20.0,18.6,11.4,15.6,17.4,16.2,15.7,14.3,14.9,14.0,20.2,17.4,18.6,17.0,16.0,12.2,10.8,12.4,10.2,19.8,23.4)
fit.frechet<-fitdist(x,"frechet")


fit.frechet<-fitdist(x,"frechet")

generating the following error

Error in computing default starting values.
Error in manageparam(start.arg = start, fix.arg = fix.arg, obs = data,  : 
  Error in start.arg.default(obs, distname) : 
  Unknown starting values for distribution frechet. `

When starting the parameters:

fit.frechet2<-fitdist(x,"frechet", start = list(loc=0,scale=1, shape=1))

Output:

 Warning messages:
1: In fitdist(x, "frechet", start = list(loc = 0, scale = 1, shape = 1)) :
  The dfrechet function should return a vector of with NaN values when input has inconsistent parameters and not raise an error
2: In fitdist(x, "frechet", start = list(loc = 0, scale = 1, shape = 1)) :
  The pfrechet function should return a vector of with NaN values when input has inconsistent parameters and not raise an error
3: In sqrt(diag(varcovar)) : NaNs produced
4: In sqrt(1/diag(V)) : NaNs produced
5: In cov2cor(varcovar) :
  diag(.) had 0 or NA entries; non-finite result is doubtful  

Fitting of the distribution ' frechet ' by maximum likelihood 
Parameters:
       estimate Std. Error
loc   -12128345   40.10705
scale  12128360   40.10705
shape   3493998        NaN

How can I estimate the parameters of the frechet in R?

Severin Pappadeux
  • 18,636
  • 3
  • 38
  • 64

1 Answers1

1

Well, you could try limit your values and start with some reasonable estimates

F.e.

fit.frechet<-fitdist(x, "frechet", method = "mle", lower = c(0, 0, 0), start = list(loc=1,scale=12, shape=4))

will produce couple of expected warnings, and

print(fit.frechet)

will print somewhat reasonable values

loc   2.146861e-07
scale 1.449643e+01
shape 4.533351e+00

with plot of fit vs empirical

plot(fit.frechet,demp=TRUE)

enter image description here

UPDATE

I would say that Frechet might not be a good fit for your data. I tried Weibull and it looks a lot better, check it yourself

fit.weibull<-fitdist(x, "weibull", method = "mle", lower = c(0, 0))
print(fit.weibull)
plot(fit.weibull, demp=TRUE)

Output is

shape  5.865337
scale 17.837188

One could note that scale parameter is kind of similar and could have been guessed just from histogram. Plot for Weibull fit, given the data it looks quite good

enter image description here

Severin Pappadeux
  • 18,636
  • 3
  • 38
  • 64