データをベータ分布に適合させ、アルファパラメータを取得する必要があります。
私はPythonでコーディングしていますが、SciPyにはベータフィッティング機能がないようです。私はあまり慣れていないMatlabですべてを行うか、Rとそのfitdistr
機能を備えたPythonで行います。だから私は後者に行きました。
from rpy2.robjects.packages import importr
MASS = importr('MASS')
次に、[0,1) の範囲のフロートの numpy ベクトルを取得し、次のように渡しますfitdistr
。
myVector = myVector.tolist()
MASS.fitdistr(myVector,"beta")
残念なことに、何らかの他のベクトルが必要です。rpy と rpy2 がすべての変換をしてくれるはずだったのではありませんか?
Error in function (x, densfun, start, ...) :
'x' must be a non-empty numeric vector
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/rpy2/robjects/functions.py", line 82, in __call__
return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/rpy2/robjects/functions.py", line 34, in __call__
res = super(Function, self).__call__(*new_args, **new_kwargs)
rpy2.rinterface.RRuntimeError: Error in function (x, densfun, start, ...) :
'x' must be a non-empty numeric vector
ここで何をする必要がありますか?