I have a variable set of responses that are expressed as an interval such as the sample below.
> head(left)
[1] 860 516 430 1118 860 602
> head(right)
[1] 946 602 516 1204 946 688
where left is the lower bound and right is the upper bound of the response. I want to estimate the parameters according to the lognormal distribution.
For a while when I was trying to calculate the likelihoods directly I was struggling with the fact that since the two bounds are distributed along different set of paramaters, I was getting some negative values like below:
> Pr_high=plnorm(wta_high,meanlog_high,sdlog_high)
> Pr_low=plnorm(wta_low, meanlog_low,sdlog_low)
> Pr=Pr_high-Pr_low
>
> head(Pr)
[1] -0.0079951419 0.0001207749 0.0008002343 -0.0009705125 -0.0079951419 -0.0022395514
I couldn't really figure out how to resolve it and decided to use the mid-point of the interval instead which is a good compromise until I found mledist function which extracts the loglikelihood of an interval response, this is the summary I get:
> mledist(int, distr="lnorm")
$estimate
meanlog sdlog
6.9092257 0.3120138
$convergence
[1] 0
$loglik
[1] -152.1236
$hessian
meanlog sdlog
meanlog 570.760358 7.183723
sdlog 7.183723 1112.098031
$optim.function
[1] "optim"
$fix.arg
NULL
Warning messages:
1: In plnorm(q = c(946L, 602L, 516L, 1204L, 946L, 688L, 1376L, 1376L, :
NaNs produced
2: In plnorm(q = c(860L, 516L, 430L, 1118L, 860L, 602L, 1290L, 1290L, :
NaNs produced
The parameter values seem to make sense and the loglikelihood is greater than any other method I have used (mid-point distribution or distribution of either one of the bounds).
There is a warning message which I don't understand so could anyone tell me if I am doing the right thing and what this message means?
Appreciate the help!
fitdistrplus
. $\endgroup$