Im trying to use the fitdist function in R to fit data to three different distributions by maximum likelihood to compare them. Lognormal and Weibull work fine, but I am struggling with Inverse Gaussian. I need to specify starting values, however when I do I get an error message.
fw<-fitdist(claims,"weibull") WORKS
fln<-fitdist(claims,"lnorm") WORKS
fig<-fitdist(claims,"invgauss",start=list(mu=0,lambda=1)) DOES NOT WORK
Error: 'The pinvgauss function should return a zero-length vector when input has length zero and not raise an error'
What is wrong with my code?
I was working with a similar issue and found the issue was with how I labeled my start values. The actuar library I was working with required the labels "mean" and "shape" on the values. The following code provided me a solution:
library(actuar)
library(fitdistrplus)
fig <- fitdist(claims, "invgauss", start = list(mean = 5, shape = 1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With