在 R 中使用 fitdist 时出错 - 必须定义 dllogis 函数

Error using fitdist in R - dllogis function must be defined

通过运行这个代码:

set.seed(12)
eta <- 10
nu <- 2
n <- 100
t <- eta*(((-1)*log(1-runif(n)))^(1/nu))# generates T_i
t
library("fitdistrplus")
fitll <- fitdist(t, "llogis")

在 R 中,我收到此错误:

Error in fitdist(t, "llogis") : The  dllogis  function must be defined

我之前安装过软件包“fitdistrplus”。关于如何解决此错误的任何想法?对于其他发行版,例如“gamma”,此代码可以正常工作。

试试这个。看起来需要调用具有所需分发的包 (flexsurv):

set.seed(12)
eta <- 10
nu <- 2
n <- 100
t <- eta*(((-1)*log(1-runif(n)))^(1/nu))# generates T_i
t
library("fitdistrplus")
library(flexsurv)
fitll <- fitdist(t, "llogis")
fitll

输出:

fitll
Fitting of the distribution ' llogis ' by maximum likelihood 
Parameters:
      estimate Std. Error
shape 3.141862  0.2609741
scale 7.659338  0.4246839