I've begun working with the Gumbel distribution and started with the example in the package documentation at https://cran.r-project.org/web/packages/fitdistrplus/fitdistrplus.pdf. For the Gumbel distribution fitdist() requires start parameters (template is fitdist(data, distr, method = c(...), start=NULL,...)), where it's described as "A named list giving the initial values of parameters of the named distribution or a function of data computing initial values and returning a named list. This argument may be omitted (default) for some distributions for which reasonable starting values are computed..." Gumbel is not on the list of distributions where start parameters may be omitted. In the below code I use the start parameters from the reference manual example and it works, but that's random. If I use start parameters of start = list(1,1) for example the function doesn't work.
Is there a way to generate these start parameters automatically? When I find start parameters that work the output is indifferent for example whether I use (5,5) or (500,500), so a hack solution would be to randomly generate parameter values until the function works. But I'm hoping for a cleaner, non-hack solution.
By the way I realize Gumbel is not a good fit for lung dataset! I'm just using lung for sake of example.
Code:
library(evd)
library(fitdistrplus)
library(survival)
Gumbel distribution
time <- seq(0, 1000, by = 1)
deathTime <- lung$time[lung$status == 1]
fitGum <- fitdist(deathTime, "gumbel",start=list(a=10,b=10))
survGum <- 1-evd::pgumbel(time, fitGum$estimate[1], fitGum$estimate[2])
plot(time,survGum,type="n",xlab="Time",ylab="Survival Probability", main="Lung Survival")
lines(survGum, type = "l", col = "red", lwd = 3) # plot Gumbel