gpt4 book ai didi

r - 使用 fitdistrplus 拟合 Gumbel 分布

转载 作者:行者123 更新时间:2023-12-04 14:12:11 25 4
gpt4 key购买 nike

我正在尝试从 this answer 中复制代码,但是我在这样做时遇到了问题。我正在使用包 VGAM 中的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'.

好像 locationscale不是*gumbel 的论据。
dgumbel , pgumbel , rgumbelqgumbelVGAM 正确提供.
然而,该包还提供了一个名为 gumbel 的函数。 , 具有不同的语法。这可能会导致问题吗?

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

最佳答案

供引用,来自 package vignette在评论中链接:

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))

或者使用来自 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))

关于r - 使用 fitdistrplus 拟合 Gumbel 分布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36087240/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com