Question

file.data has the following values to fit with Weibull distribution,

x       y 
2.53    0.00
0.70    0.99
0.60    2.45
0.49    5.36
0.40    9.31
0.31    18.53
0.22    30.24
0.11    42.23

Following the Weibull distribution function f(x)=1.0-exp(-lambda*x**n), it is giving error:

fit f(x) 'data.dat' via lambda, n

and finally plotting f(x) and xy graph have large discrepancy.

Any feedback would be highly appreciated. Thanks!

Was it helpful?

Solution

Several things:

  1. You must skip the first line (if it really is x y).

  2. You must use the correct function (the pdf and not the CDF, see http://en.wikipedia.org/wiki/Weibull_distribution, like you did in https://stackoverflow.com/q/20336051/2604213)

  3. You must use an additional scaling parameter, because your data are not normalized

  4. You must select adequate initial values for the fitting.

The following works fine:

f(x) = (x < 0 ? 0 : a*(x/lambda)**(n-1)*exp(-(x/lambda)**n))
n = 0.5
a = 100
lambda = 0.15
fit f(x) 'data.dat' every ::1 via lambda, n, a

set encoding utf8
plot f(x) title sprintf('λ = %.2f, n = %.2f', lambda, n), 'data.dat' every ::1

That gives (with 4.6.4):

enter image description here

OTHER TIPS

If that's the actual command you provided to gnuplot, it won't work because you haven't yet defined f(x).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top