5

I'm trying to reproduce the code from this answer, however I have problems in doing so. I'm using the gumbel distribution from package VGAM and fitdistrplus. The problem emerges when doing:

fit   = fitdist(data1, 'gumbel', start = list(location = 0, scale = 1))
Error in mledist(data, distname, start, fix.arg, ...) : 
  'start' must specify names which are arguments to 'distr'.

As if location and scale were not arguments of *gumbel.

dgumbel, pgumbel, rgumbel and qgumbel are correctly provided by VGAM. However the package also provides a function called gumbel, with different syntax. May this be causing problems?

EDIT: yes indeed it is causing problems: using package FAdist instead works perfectly fine.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
AF7
  • 3,160
  • 28
  • 63

3 Answers3

5

For reference, from the package vignette linked in comments:

library(fitdistrplus)
data(groundbeef)
serving <- groundbeef$serving
dgumbel <- function(x, a, b) 1/b*exp((a-x)/b)*exp(-exp((a-x)/b))
pgumbel <- function(q, a, b) exp(-exp((a-q)/b))
qgumbel <- function(p, a, b) a-b*log(-log(p))
fitgumbel <- fitdist(serving, "gumbel", 
    start=list(a=10, b=10))

Or with the functions from VGAM:

rm(dgumbel) ## get rid of previous definition
## hack behaviour of VGAM::pgumbel() a little bit
pgumbel <- function(x,...) {
  if (length(x)==0) numeric(0) else VGAM::pgumbel(x,...)
}
library(VGAM)
fitgumbel <- fitdist(serving, "gumbel", 
       start=list(location=10, scale=10))
Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
-2

start=list(mu=R,s=R) R=your params

-2

This is because the fitdistr package do not support gumbel distribution.

Forever
  • 385
  • 3
  • 16
  • 1
    Do you have any source, explanation or reference? – AF7 Aug 06 '17 at 20:12
  • if you use 'gumbel' it says : unsupported distribution. Then in the package documentation: 'Distributions "beta", "cauchy", "chi-squared", "exponential", "f", "gamma", "geometric", "log-normal", "lognormal", "logistic", "negative binomial", "normal", "Poisson", "t" and "weibull" are recognised, case being ignored. Libraries ismev and EnvStats can estimate gumbel parameters – Forever Aug 06 '17 at 20:28
  • actually the "gumbel" distribution is used also in the package docs: https://cran.r-project.org/web/packages/fitdistrplus/fitdistrplus.pdf, page 29, with a custom-defined gumbel. Why does the gumbel from `VGAM` not work? By the way in the above documentation the string you mentioned is not present. Where did you get it? Please provide links. – AF7 Aug 07 '17 at 10:03
  • But you have to define the gumbel distribution by your own to get the fit. – Forever Aug 08 '17 at 12:05