威布尔分布中的错误 [英] Error in Weibull distribution
问题描述
file.data具有以下值以适合Weibull分布
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
在Weibull分布函数f(x)=1.0-exp(-lambda*x**n)
之后,出现错误:
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
最后绘制f(x)和xy图有很大差异.
and finally plotting f(x) and xy graph have large discrepancy.
任何反馈将不胜感激.谢谢!
Any feedback would be highly appreciated. Thanks!
推荐答案
几件事:
-
您必须跳过第一行(如果它确实是
x y
).
您必须使用正确的功能(PDF而不是CDF,请参见 http://en.wikipedia.org/wiki/Weibull_distribution ,就像您在 https://stackoverflow.com/q/20336051中所做的一样/2604213 )
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)
您必须使用其他缩放参数,因为您的数据未标准化
You must use an additional scaling parameter, because your data are not normalized
您必须为拟合选择足够的初始值.
You must select adequate initial values for the fitting.
以下可以正常工作:
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
给出(含4.6.4):
That gives (with 4.6.4):
这篇关于威布尔分布中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!