# Example data
X = np.random.normal(10, 3, 2000)
y = [3,4,5,6,10,11,12,18,20]
# From the distfit library import the class distfit
from distfit import distfit
# Initialize
dfit = distfit(todf=True)
# Search for best theoretical fit on your empirical data
dfit.fit_transform(X)
# Make prediction on new datapoints based on the fit
results = dfit.predict(y)
# The plot function will now also include the predictions of y
dfit.plot()
结果如下:
results['df']
y y_proba y_pred P
0 3.0 0.023792 down 0.007931
1 4.0 0.044730 down 0.019880
2 5.0 0.079661 down 0.044256
3 6.0 0.131986 none 0.087990
4 10.0 0.492335 none 0.492335
5 11.0 0.406206 none 0.361072
6 12.0 0.315383 none 0.245298
7 18.0 0.018689 up 0.004153
8 20.0 0.004836 up 0.000537
2条答案
按热度按时间7fyelxc51#
在问题中没有提供任何数据的情况下,我建议从θ = 2的Gumbel copula创建样本,然后尝试将Gumbel copula拟合到所获得的样本以猜测θ
对于样本量为5000的情况,我得出猜测θ = 2.0099533501045226
More available OpenTURNS Copulas here
jk9hmnmh2#
使用
distfit
函数库,您可以拟合定价历史数据的分布,然后使用predict
函数对新的未知样本进行预测。请参阅此处的更多文档。predict函数返回经过多重检验校正的P值。结果如下: