Referring to the subject:
Fitting a lognormal distribution to truncated data in R
I am trying to estimate parameters of a truncated lognormal distribution:
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))
But I get the below error:
Error in manageparam(start.arg = start, fix.arg = fix.arg, obs = data, :
Wrong type of argument for start
Where is the problem? It is about the initial values. But I can't solve it.
I will be very glad for any help.
Thanks a lot.