使用 fitdistrplus 拟合 Gumbel 分布

AF7*_*AF7 5 r model-fitting fitdistrplus

我正在尝试重现此答案中的代码,但是这样做时遇到问题。VGAM我正在使用 package和中的gumbel 发行版fitdistrplus。执行以下操作时出现问题:

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'.
Run Code Online (Sandbox Code Playgroud)

就好像locationscale不是 *gumbel 的参数一样。

dgumbelpgumbelrgumbelqgumbel均由 正确提供VGAM。然而,该包还提供了一个名为 的函数gumbel,具有不同的语法。这可能会引起问题吗?

编辑:是的,它确实引起了问题:使用包FAdist代替工作得很好。

Ben*_*ker 5

作为参考,来自评论中链接的包小插图:

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))
Run Code Online (Sandbox Code Playgroud)

或者使用以下函数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))
Run Code Online (Sandbox Code Playgroud)