在R中拟合截断的对数正态分布

时间:2019-03-26 17:12:36

标签: r distribution data-fitting

参考主题:

Fitting a lognormal distribution to truncated data in R

我正在尝试估计截断对数正态分布的参数:

library(fitdistrplus)
library(truncdist)


D <- rlnorm(1000,meanlog = -0.75, sdlog = 1.5)
# Censor data #
min <- 0.10
max <- 20
Dt <- D[D > min]
Dt <- Dt[Dt <= max]

#fitt <- fitdist(Dt, "lognormal", lower = min, upper = max)

dtruncated_log_normal <- function(x, meanlog, sdlog) 
  dtrunc(x, "lnorm", a=.10, b=20, meanlog=meanlog, sdlog=sdlog)
ptruncated_log_normal <- function(x, meanlog, sdlog) 
  ptrunc(x, "lnorm", a=.10, b=20, meanlog=meanlog, sdlog=sdlog)

fitdist(Dt, "truncated_log_normal", start = c(meanlog=0, sdlog=1))

但是出现以下错误:

Error in manageparam(start.arg = start, fix.arg = fix.arg, obs = data,  : 
  Wrong type of argument for start

问题出在哪里?它与初始值有关。但是我解决不了。

我将很高兴获得任何帮助。

非常感谢。

0 个答案:

没有答案