Skip to content

Instantly share code, notes, and snippets.

View aneutron's full-sized avatar
🐢
Learning stuff and breaking things

Ayoub Boudhar aneutron

🐢
Learning stuff and breaking things
View GitHub Profile
function [t a prob] = MH_routine(theta,p,proposal_PDF,sample_from_proposal_PDF)
% Metropolis-Hastings algorithm routine:
theta_ast = sample_from_proposal_PDF(theta); % sampling from the proposal PDF with media the current state
alpha = (p(theta_ast)*proposal_PDF(theta,theta_ast))/... % Ratio of the density at the
(p(theta) *proposal_PDF(theta_ast,theta)); % candidate (theta_ast) and current (theta) points
if rand <= min(alpha,1)
t = theta_ast; % Accept the candidate
prob = min(alpha,1); % Accept with probability min(alpha,1)
a = 1; % Note the acceptance

Keybase proof

I hereby claim:

  • I am aneutron on github.
  • I am ayoubboudhar (https://keybase.io/ayoubboudhar) on keybase.
  • I have a public key ASAZIgq1ZaAf6HkowJv-T9fKx9LitmVXqC93MZmhicbuggo

To claim this, I am signing this object:

<?php
function base_url(){
$base_url = is_https() ? 'https' : 'http';
$base_url .= '://'.$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
return $base_url;
}