Learn R Programming

bayess (version 1.6)

isingibbs: Gibbs sampler for the Ising model

Description

This is the original Geman and Geman (1984) Gibbs sampler on the Ising model that gave its name to the method. It simulates an \(n\times m\) grid from the Ising distribution.

Usage

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

Value

x, a realisation from the Ising distribution as a matrix of size n x m

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

References

Geman, S. and Geman, D. (1984) Stochastic relaxation, Gibbs distributions and the Bayesian restoration of images. IEEE Trans. Pattern Anal. Mach. Intell., 6, 721--741.

See Also

isinghm

Examples

Run this code
image(1:20,1:20,isingibbs(10,20,20,beta=0.3))

Run the code above in your browser using DataLab