我正在尝试使用fitdist ()
函数从fitdistrplus
包以使我的数据适合不同的分布。假设我的数据如下所示:
x = c (1.300000, 1.220000, 1.160000, 1.300000, 1.380000, 1.240000,
1.150000, 1.180000, 1.350000, 1.290000, 1.150000, 1.240000,
1.150000, 1.120000, 1.260000, 1.120000, 1.460000, 1.310000,
1.270000, 1.260000, 1.270000, 1.180000, 1.290000, 1.120000,
1.310000, 1.120000, 1.220000, 1.160000, 1.460000, 1.410000,
1.250000, 1.200000, 1.180000, 1.830000, 1.670000, 1.130000,
1.150000, 1.170000, 1.190000, 1.380000, 1.160000, 1.120000,
1.280000, 1.180000, 1.170000, 1.410000, 1.550000, 1.170000,
1.298701, 1.123595, 1.098901, 1.123595, 1.110000, 1.420000,
1.360000, 1.290000, 1.230000, 1.270000, 1.190000, 1.180000,
1.298701, 1.136364, 1.098901, 1.123595, 1.316900, 1.281800,
1.239400, 1.216989, 1.785077, 1.250800, 1.370000)
接下来,如果我跑fitdist (x, "gamma")
一切都很好,但如果我使用fitdist (x, "beta")
相反,我收到以下错误:
Error in start.arg.default(data10, distr = distname) :
values must be in [0-1] to fit a beta distribution
好的,所以我不是母语英语,但据我了解,此方法要求数据在 [0,1] 范围内,所以我使用x_scaled = (x-min(x))/max(x)
。这给了我一个向量,其值在该范围内,与原始向量完美相关x
.
因为x_scaled
is of class matrix
,我使用转换为数值向量as.numeric()
。然后拟合模型fitdist(x_scale,"beta")
.
这次我收到以下错误:
Error in fitdist(x_scale, "beta") :
the function mle failed to estimate the parameters, with the error code 100
所以在那之后我一直在做一些搜索引擎查询,但我没有找到任何有用的东西。有人知道这里出了什么问题吗?谢谢