我正在try 将一些代码从MatLab移植到Python,我意识到MatLab中的gevfit
函数似乎与Scipy genextreme
的行为不同,所以我意识到了这个最小的例子:
MATLAB
% Create the MATLAB array
x = [0.5700, 0.8621, 0.9124, 0.6730, 0.5524, 0.7608, 0.2150, 0.5787, ...
0.7210, 0.7826, 0.8181, 0.5449, 0.7501, 1.1301, 0.7784, 0.5378, ...
0.9550, 0.9623, 0.6865, 0.6863, 0.6153, 0.4372, 0.5485, 0.6318, ...
0.5501, 0.8333, 0.8044, 0.9111, 0.8560, 0.6178, 1.0688, 0.7535, ...
0.7554, 0.7123, 0.7589, 0.8415, 0.7586, 0.3865, 0.3087, 0.7067];
disp(numbers);
parmHat = gevfit(x);
disp('Estimated parameters (A, B):');
disp(parmHat);
估计参数(A,B):-0.3351 0.1962 0.6466
巨 Python
import numpy as np
import scipy.stats as stats
x = np.array([0.5700, 0.8621, 0.9124, 0.6730, 0.5524, 0.7608, 0.2150, 0.5787,
0.7210, 0.7826, 0.8181, 0.5449, 0.7501, 1.1301, 0.7784, 0.5378,
0.9550, 0.9623, 0.6865, 0.6863, 0.6153, 0.4372, 0.5485, 0.6318,
0.5501, 0.8333, 0.8044, 0.9111, 0.8560, 0.6178, 1.0688, 0.7535,
0.7554, 0.7123, 0.7589, 0.8415, 0.7586, 0.3865, 0.3087, 0.7067])
# Fit the GEV distribution to the data
parameters3 = stats.genextreme.fit(x)
print("Estimated GEV parameters:", parameters3)
估计GEV参数:(1.0872284332032054,0.534605335200113, 0.6474387313912493)
我希望参数相同,但结果完全不同.有什么帮助吗?