rdistributionfitdistrplus

Error in fitting data to Gumbel distribution using fitdist in R


I am trying to run the following for Gumbel distribtuion:

    (gdist<-fitdist(z1,dgumbel,start=list(mu=22.147,sd=38.372)))
    summary(gdist)

The following error comes up:

    Error in checkparamlist(arg_startfix$start.arg, arg_startfix$fix.arg,  
    :  'start' must specify names which are arguments to 'distr'.

My data head looks like:

    > head(data)
   Year No     z1   SOI
 1 1900  1  11.05  14.6
 2 1901  2   9.23  14.7
 3 1902  3  39.48  -1.6
 4 1903  4 -43.41   1.9
 5 1904  5  -8.26  -5.1
 6 1905  6 -33.97 -20.1

Solution

  • Your input of the start parameter is wrong. Since there are a lot of different packages which have gumbel you have to check which one you use and see the parameters. You need to give the parameters of dgumbel to the start value. For ordinal package:

    dgumbel(x, location = 0, scale = 1, log = FALSE, max = TRUE)
    

    So your start=list() has to provide location and scale.

    for extraDistr (documentation)

    dgumbel(x, mu = 0, sigma = 1, log = FALSE)
    

    So the start=list() needs to include the parameters mu and sigma

    here an example how to use it accordingly:

     gdist<-fitdist(df$z1,dgumbel,start=list(mu=22.147, sig= 38.372))
    

    This gives you an output. The error message is fixed by calling the correct names of the start values for the dgumbel function. Since i can't figure out which package you use i recommend checking the documentation or using ?dgumbel to see it in your IDE if you use one.

    Change the parameter names to the used ones in the documentation.