I am trying to fit shifted exponential distribution to my data but fitdist function giving error of 100 and failing to estimate starting values. I also used plotdist function to find starting or initial values in order to fit the distribution and I have obtained the followings plots with parameters rate = 0.155 shift = 0.00001 after iteration process and even I used these values in fitdist as well. I used mledist function to calculate starting values of distribution parameters as well but it is also not working. I used fitdist function as well it gives the following error:
Error in fitdist(x, "sexp", start = list(rate = 0.155, shift = 1e-05)) : the function mle failed to estimate the parameters, with the error code 100
The code is as below:
library(fitdistrplus)
library(readxl)
library(tidyverse)
library(here)
library(janitor)
# Load data-------------------------------
pvr <- read_excel(here("data", "pvr.xlsx"))
pvr <- pvr %>%
select(-starts_with("...")) %>%
clean_names(case = "snake")
x <- pvr$headway
rate <- 0.155
shift <- 0.00001
dsexp <- function(x, rate, shift)
dexp(x-shift, rate=rate)
psexp <- function(x, rate, shift)
pexp(x-shift, rate=rate)
qsexp <- function(x, rate, shift)
qexp(x-shift, rate=rate)
f12 <- fitdist(x, "sexp", start = list(rate=0.155, shift=0.00001), lower = c(0, -min(x)))
The data may be downloaded from the following link below:
Can anyone help me in this regard?
The fitdist function uses mle method as default. The code works just by changing the method from mle to mse or mge.