# fitting a log-logistic distribution

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?

• Why not just take logs and fit a logistic? As for suitable starting values, the location of the logistic would be well-estimated via the median of the Walsh averages (the one-sample Hodges-Lehmann) -- it's asymptotically efficient, though it may not be suitable in very large samples. A reasonable starting value for the scale parameter could be obtained from the mean deviation from this location estimate (specifically by dividing it by $2\log2\approx 1.3863$). There are a number of other fairly efficient, fairly simple location estimators. Dec 11, 2018 at 3:17

## 1 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.