# Inferring Ising Model parameters

Hi,

I’m trying to understand if I can use Stan in an inference problem I’m faced with, and would appreciate any feedback. Disclaimer - I’m relatively new to Bayesian methods in general, and very new to Stan and R in particular (used python so far).

The problem domain is 2D Ising models - maximum entropy models over binary variables, constrained by means and pairwise correlations. These distributions are parametrized by the Lagrange multipliers satisfying these constraints (the “fields” and “couplings” in stat. mech terms). I have samples from a given distribution, and I’m trying to use bayesian inference to estiamate the parameters of this distribution (which are continuous variables). I’ve played around with the IsingFit library, but as far as I can tell, this library:

1. Does not provide an estimate of the uncertainty in the inferred values (ideally, I’d want to see “tighter” estimates given more data).
2. Ultimately, I’m interested in representing the MaxEnt model parameters as functions of other variables, and putting priors on them - I don’t think this is supported by IsingFit.

It this possible to do with Stan? Any help would be much appreciated.

Stan doesn’t work on this type of discrete model. In particular, you can’t declare any parameters to be discrete.

Maybe this package would be useful https://cran.r-project.org/web/packages/bayesImageS/index.html

In this problem, the data are discrete (binary patterns), but the parameters I’m trying to estimate are continuous variables. Once I “plug” the data to the likelihood function, doesn’t the entire problem becomes a continuous inference problem? Or is it the “plugging-in the data” part that is the problem?

For the ising model, the problem is that you can’t compute the normalising constant (aka the partition function). Stan needs and explicit expression for this.

I see, because it depends on the parameters as well? This is avoided, conveniently enough, when sampling the binary patterns themselves, since the partition function doesn’t depends on them (they’re integrated over); I hoped there might be a similar trick, here, as well.

Thanks for your help! If anyone knows other packages/refs that might be relevant, I’d appreciate it.

See my first response.

But for the most part, you have to “roll your own” for this sort of problem.