Commit fb4432fe authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[SIMULATION] add simulation file to check issue that existed with respect to...

[SIMULATION] add simulation file to check issue that existed with respect to quantile gap in my last presentation
parent 3ac4641c
No related merge requests found
Showing with 46 additions and 1 deletion
+46 -1
...@@ -97,7 +97,7 @@ def complete_analysis(only_first_one=False): ...@@ -97,7 +97,7 @@ def complete_analysis(only_first_one=False):
if __name__ == '__main__': if __name__ == '__main__':
# annual_mean_vizu_compare_durand_study(safran=True, take_mean_value=True, altitude=2400) # annual_mean_vizu_compare_durand_study(safran=True, take_mean_value=True, altitude=2400)
normal_visualization(temporal_non_stationarity=True) normal_visualization(temporal_non_stationarity=False)
# max_stable_process_vizu_compare_gaume_study(altitude=1800, nb_days=1) # max_stable_process_vizu_compare_gaume_study(altitude=1800, nb_days=1)
# extended_visualization() # extended_visualization()
# complete_analysis() # complete_analysis()
import numpy as np
import matplotlib.pyplot as plt
from extreme_estimator.extreme_models.utils import r, set_seed_r
def convergence_quantile_function(zoom=False):
# Convergence of the quantile function
eps = 1e-3
left = 0.9 if zoom else eps
p = np.linspace(left, 1-eps, 100)
# n_list = range(1, 10)
n_list = [1, 10, 100]
for n in n_list:
v = r.qexp(np.power(p, 1/n))
plt.plot(p, v, label=n)
quantile_perfect_gev = np.array(r.qgev(p, shape=0))
quantile_perfect_gev += np.log(n)
plt.plot(p, quantile_perfect_gev, label='gev' + str(n))
plt.legend()
plt.show()
# remark: convergence is from above, the block maxima quantiles are above its correspond quantile gev distribtuion
# this contradicts the hypothesis the issue I raised in "Simulation to understand quantile gap"
def convergence_repartition_function():
# Convergence of the repartition function
lim = 2
x = np.linspace(-lim, lim, 100)
plt.plot(x, r.pgev(x, shape=0), label='gev')
for n in range(1, 20, 5):
v = (np.power(r.pexp(x + np.log(n)), n))
plt.plot(x, v, label=n)
plt.legend()
plt.show()
if __name__ == '__main__':
set_seed_r(seed=21)
convergence_quantile_function(zoom=True)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment