Esempio n. 1
0
time_series_stepsize = stepsize[sample_idx]
time_series_acceptance = acceptance[sample_idx]
mh.steps_size_time_series(title, time_series_samples, time, time_series_stepsize, time_series_acceptance, [-0.2, 1.75], [51250, 0.025], "metropolis_hastings_sampling", "normal_proposal_time_series_stepsize_comparison")

# %%

μ = stats.weibull_mean(k, λ)
title = r"Weibull Target, Normal Proposal, $μ_E$ Convergence: $X_0$="+f"{format(x0, '2.1f')}"
time = range(nsample)
mean_samples = [all_samples[i][time] for i in sample_idx]
mean_stepsize = stepsize[sample_idx]
mh.step_size_mean(title, mean_samples, time, μ, mean_stepsize, "metropolis_hastings_sampling", "normal_proposal_mean_convergence_stepsize_comparison", (0.75, 0.7))

# %%

σ = stats.weibull_sigma(k, λ)
title = r"Weibull Target, Normal Proposal, $σ_E$ Convergence: $X_0$="+f"{format(x0, '2.1f')}"
time = range(nsample)
sigma_samples = [all_samples[i][time] for i in sample_idx]
sigma_stepsize = stepsize[sample_idx]
mh.step_size_sigma(title, sigma_samples, time, σ, sigma_stepsize, "metropolis_hastings_sampling", "normal_proposal_sigma_convergence_stepsize_comparison", (0.7, 0.3))

# %%

title = f"Weibull Target, Normal Proposal, Autocorrelation, stepsize comparison"
auto_core_range = range(20000, 50000)
autocorr_samples = [all_samples[i][auto_core_range] for i in sample_idx]
autocorr_stepsize = stepsize[sample_idx]
nplot = 100

# %%
Esempio n. 2
0
time_series_stepsize = stepsize[sample_idx]
time_series_acceptance = acceptance[sample_idx]
mh.steps_size_time_series(title, time_series_samples, time, time_series_stepsize, time_series_acceptance, [-0.2, 1.75], [51150, 0.15], "metropolis_hastings_sampling", "gamma_proposal_time_series_stepsize_comparison")

# %%

μ = stats.weibull_mean(5.0, 1.0)
title = f"Weibull Distribution, Gamma Proposal, Sample μ Convergence"
time = range(nsample)
mean_samples = [all_samples[i][time] for i in sample_idx]
mean_stepsize = stepsize[sample_idx]
mh.step_size_mean(title, mean_samples, time, μ, mean_stepsize, "metropolis_hastings_sampling", "gamma_proposal_mean_convergence_stepsize_comparison")

# %%

σ = stats.weibull_sigma(5.0, 1.0)
title = f"Weibull Distribution, Gamma Proposal, sample σ convergence stepsize comparison"
time = range(nsample)
sigma_samples = [all_samples[i][time] for i in sample_idx]
sigma_stepsize = stepsize[sample_idx]
mh.step_size_sigma(title, sigma_samples, time, σ, sigma_stepsize, "metropolis_hastings_sampling", "gamma_proposal_sigma_convergence_stepsize_comparison")

# %%

title = f"Weibull Distribution, Gamma Proposal, Autocorrelation stepsize comparison"
auto_core_range = range(20000, 50000)
autocorr_samples = [all_samples[i][auto_core_range] for i in sample_idx]
autocorr_stepsize = stepsize[sample_idx]
nplot = 200
mh.step_size_autocor(title, autocorr_samples, autocorr_stepsize, nplot, "metropolis_hastings_sampling", "gamma_proposal_autocorrelation_convergence_stepsize_comparison")