I have been doing some data analysis in R and I am trying to figure out how to fit my data to a 3 parameter Weibull distribution. I found how to do it with a 2 parameter Weibull but have come up short in finding how to do it with a 3 parameter.
Here is how I fit the data using the fitdistr
function from the MASS
package:
y <- fitdistr(x[[6]], 'weibull')
x[[6]]
is a subset of my data and y is where I am storing the result of the fitting.
A alternative is the package "lmom". The estimative by L-moments technique
But I don´t know how to do some Goodness-of-fit statistics in this package or in the solution above. Others packages you can do Goodness-of-fit statistics easily. Anyway, you can use alternatives like: ks.test or chisq.test
First, you might want to look at FAdist package. However, that is not so hard to go from
rweibull3
torweibull
:and similarly from
dweibull3
todweibull
so we have this
Edit: As mentioned in the comment, there appears various warnings when trying to fit the distribution in this way
For me at first it was only
NaNs produced
, and that is not the first time when I see it so I thought that it isn't so meaningful since estimates were good. After some searching it seemed to be quite popular problem and I couldn't find neither cause nor solution. One alternative could be usingstats4
package andmle()
function, but it seemed to have some problems too. But I can offer you to use a modified version of code by danielmedic which I have checked a few times: