… using Stan & HMC
Here, I sample from an Ising-like model (I treat the random variables as continuous, between -1 and 1 and add a term to the pseudo-likelihood that resembles a beta log density).

functions {
real log_p ( matrix m , real T , real alpha ) {
int n = rows ( m );
return ( ( 1 / T ) * sum ( m [ 2 : ( n - 1 ), 2 : ( n - 1 )] . * m [ 1 : ( n - 2 ), 2 : ( n - 1 )] +
m [ 2 : ( n - 1 ), 2 : ( n - 1 )] . * m [ 2 : ( n - 1 ), 1 : ( n - 2 )] +
m [ 2 : ( n - 1 ), 2 : ( n - 1 )] . * m [ 3 : n , 2 : ( n - 1 )] +
m [ 2 : ( n - 1 ), 2 : ( n - 1 )] . * m [ 2 : ( n - 1 ), 3 : n ]) +
sum ( log ( m / 2 + 0.5 ) * ( alpha - 1 ) + log ( 0.5 - m / 2 ) * ( alpha - 1 ) ));
}
}
data {
int n ;
real T ;
real alpha ;
}
parameters {
matrix < lower = - 1 , upper = 1 > [ n , n ] m ;
}
model {
target += log_p ( m , T , alpha );
}

The matrix terms are essentially a vectorised product-sum of nearest neighbour spins.

Results:

2019

… using Stan & HMC
~1 min read
August 22, 2019

A Minimal Working Example
~1 min read
August 20, 2019

Random Stuff
2 min read
August 15, 2019
~1 min read
August 15, 2019

Random Projects
1 min read
August 11, 2019

Musings on Statistics
~1 min read
August 11, 2019

Probability & Sigma Algebras
2 min read
August 11, 2019
Back to Top ↑
2018

Introduction
4 min read
December 14, 2018

Introduction
4 min read
November 24, 2018

8 min read
November 22, 2018
Back to Top ↑