Solved – fitting a log-logistic distribution

distributionsestimationlogisticr

I am conducting survival analysis research and I am trying to decide which distribution (Weibull, lognormal and loglogistic) best fits my data.

One can "Fit of univariate distributions to non-censored data" using the fitdist() from the fitdistrplus package in R.

referring to the examples from the help page, we can fit hypothetical distributions by the following:

fitW <- fitdist(serving, "weibull")
fitg <- fitdist(serving, "gamma")
fitln <- fitdist(serving, "lnorm") 

etc.

But one cannot fit an assumed log-logistic distribution with the package.

From research, I have found this paper (see pg 5-6) which attempts to implement a secondary package, actuar which has the capability to fit a loglogis distribution.

Here we find the code:

fendo.ll <- fitdist(ATV, "llogis", start = list(shape = 1, scale = 500))

which then states at the bottom of the page

It can thus help to find correct initial values for the distribution parameters in non trivial cases, by iterative calls if necessary (see the reference manual for examples (Delignette-Muller et al., 2014))

So can one explain where these values come from?

Best Answer

I am not sure I understand your problem, but this can be done directly with fitdistr. See the following code:

library(fitdistrplus)
library(actuar)

test <- actuar::rllogis(500, 3.3, 1)
fitdist(test, "llogis")
Fitting of the distribution ' llogis ' by maximum likelihood 
Parameters:
      estimate Std. Error
shape 3.374404 0.12585423
scale 0.998631 0.02296057

The fitdistr function do not have a set of predefined distribution models, it just assumes that pdqr... functions corresponding to basename llogis exist somewhere on the search path.

Related Question