I'd like to perform a log Pearson III fit to some data points I have. However, everytime I try to it I get errors messages I don't really know what to do about. I should perhaps add that I'm only using R since a couple of days ago, so, I'm not an expert in it.
The important code part, the part without the import stuff and so so on is this:
pIIIpars<-list(shape=1, location=1, scale=1)
dPIII<-function(x, shape, location, scale) PearsonDS::dpearsonIII(x, shape=1, location=1, scale=1, params=pIIIpars, log=FALSE)
pPIII<-function(q, shape, location, scale) PearsonDS::ppearsonIII(q, shape=1, location=1, scale=1, params=pIIIpars, lower.tail = TRUE, log.p = FALSE)
qPIII<-function(p, shape, location, scale) PearsonDS::qpearsonIII(p, shape=1, location=1, scale=1, params=pIIIpars, lower.tail = TRUE, log.p = FALSE)
fitPIII<-fitdistrplus::fitdist(flowdata3$OEP, distr="PIII", method="mle", start=list("shape"=5000, "location"=5000, "scale"=5000))
summary(fitPIII)
plot(fitPIII)
I'm using the PearsonDS package for the definition of the Log Pearson III distribution and fitdistrplus to do the fit.
The error message I always get is this:
[1] "Error in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data, : \n function cannot be evaluated at initial parameters\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data, ddistnam = ddistname, hessian = TRUE, method = meth, lower = lower, upper = upper, ...): function cannot be evaluated at initial parameters>
Error in fitdistrplus::fitdist(flowdata3$OEP, distr = "PIII", method = "mle", :
the function mle failed to estimate the parameters,
with the error code 100
I do unterstand the error message, it's just; if that's not the correct way to pass initial values, what is? Anyone have an idea?
Cheers, Robert