Learn R Programming

bayess (version 1.6)

isinghm: Metropolis-Hastings for the Ising model

Description

This is the Metropolis-Hastings version of the original Gibbs algorithm on the Ising model (Chapter 8). Its basic step only proposes changes of values at selected pixels, avoiding the inefficient updates that do not modify the current value of x.

Usage

isinghm(niter, n, m=n,beta)

Value

x, a realisation from the Ising distribution as a n x m matrix of 0's and 1's

Arguments

niter

number of iterations of the algorithm

n

number of rows in the grid

m

number of columns in the grid

beta

Ising parameter

See Also

isingibbs

Examples

Run this code
prepa=runif(1,0,2)
prop=isinghm(10,24,24,prepa)
image(1:24,1:24,prop)

Run the code above in your browser using DataLab