Learn R Programming

PottsUtils (version 0.3-3)

getNC: Calculate the Normalizing Constant of a Simple Potts Model

Description

Use the thermodynamic integration approach to calculate the normalizing constant of a Simple Potts Model.

Usage

getNC(beta, subbetas, nvertex, ncolor,
        edges, neighbors=NULL, blocks=NULL, 
        algorithm=c("SwendsenWang", "Gibbs", "Wolff"), n, burn)

Arguments

beta

the inverse temperature parameter of the Potts model.

subbetas

vector of betas used for the integration.

nvertex

number of vertices in a graph.

ncolor

number of colors each vertex can take.

edges

all edges in a graph.

neighbors

all neighbors in a graph. The default is NULL. If the sampling algorithm is "BlocksGibbs" or "Wolff", then this has to be specified.

blocks

the blocks of vertices of a graph. The default is NULL. If the sampling algorithm is "BlocksGibbs", then this has to be specified.

algorithm

a character string specifying the algorithm used to generate samples. It must be one of "SwendsenWang", "Gibbs", or "Wolff" and may be abbreviated. The default is "SwendsenWang".

n

number of iterations.

burn

number of burn-in.

Value

The corresponding normalizing constant.

Details

Use the thermodynamic integration approach to calculate the normalizing constant from a simple Potts model. See rPotts1 for more information on the simple Potts model.

By the thermodynamic integration method, $$ \log{C(\beta)} = N\log{k} + \int_{0}^{\beta}E(U({\bf z})|\beta^{'}, k)d\beta^{'} $$ where N is the total number of vertices (nvertex), k is the number of colors (ncolor), and \(U({\bf z}) = \sum_{i \sim j}\textrm{I}(z_{i}=z_{j})\). Calculate \(E(U({\bf z})\) for subbetas based on samples, and then compute the integral by numerical integration.

References

Peter J. Green and Sylvia Richardson (2002) Hidden Markov Models and Disease Mapping Journal of the American Statistical Association vol. 97, no. 460, 1055-1070

See Also

BlocksGibbs, SW, Wolff

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  #Example 1: Calculate the normalizing constant of a simple Potts model
  #           with the neighborhood structure corresponding to a
  #           first-order Markov random field defined on a
  #           3*3 2D graph. The number of colors is 2 and beta=2.
  #           Use 11 subbetas evenly distributed between 0 and 2.
  #           The sampling algorithm is Swendsen-Wang with 10000
  #           iterations and 1000 burn-in. 
 
  edges <- getEdges(mask=matrix(1,3,3), neiStruc=c(2,2,0,0))
  getNC(beta=2, subbetas=seq(0,2,by=0.2), nvertex=3*3, ncolor=2,
        edges, algorithm="S", n=10000, burn=1000)
  
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab