Wolff: Generate Random Samples from a Compound Potts Model by the...

Description Usage Arguments Details Value References See Also Examples

Description

Generate random samples from a compound Potts model using the Wolff Algorithm.

Usage

1
  Wolff(n, nvertex, ncolor, neighbors, weights, beta)

Arguments

n

number of samples.

nvertex

number of vertices of a graph.

ncolor

number of colors each vertex can take.

neighbors

neighbors of a graph.

weights

weights between neighbors. One for each corresponding component in neighbors. The default values are 1s for all.

beta

the parameter inverse temperature of the Potts model.

Details

We use the Wolff algorithm to generate random samples from a compound Potts model. See rPotts1 for more information on the compound Potts model.

Value

A nvertex by n matrix with the kth column being the kth sample.

References

Ulli Wolff (1989) Collective Monte Carlo Updating for Spin Systems Physical Review Letters vol. 62, no. 4, 361-364

Dai Feng (2008) Bayesian Hidden Markov Normal Mixture Models with Application to MRI Tissue Classification Ph. D. Dissertation, The University of Iowa

See Also

SW, BlocksGibbs

Examples

1
2
3
4
5
6
7
8
  #Example 1: Generate 100 samples from a Potts model with the
  #           neighborhood structure corresponding to a
  #           second-order Markov random field defined on a 
  #           3*3 2D graph. The number of colors is 2.
  #           beta=0.7. All weights are equal to 1.

  neighbors <- getNeighbors(mask=matrix(1, 3, 3), neiStruc=rep(2,4))
  Wolff(n=100, nvertex=9, ncolor=2, neighbors, beta=0.7)

Example output

      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
 [1,]    2    2    2    1    1    1    2    1    2     2     2     1     2
 [2,]    1    1    2    1    2    1    2    1    2     1     2     1     2
 [3,]    1    1    2    1    2    1    2    1    2     1     2     1     2
 [4,]    1    1    2    1    2    1    2    1    2     1     1     1     2
 [5,]    1    1    2    1    2    1    2    1    2     1     2     1     2
 [6,]    2    2    2    1    2    1    2    1    2     1     2     1     2
 [7,]    1    1    2    1    2    1    2    1    2     2     2     1     1
 [8,]    1    2    2    1    2    1    2    1    2     1     1     1     2
 [9,]    2    2    2    1    2    1    2    1    2     1     2     1     2
      [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
 [1,]     1     2     2     1     2     2     2     2     1     1     2     1
 [2,]     1     2     2     1     2     2     1     2     1     2     2     1
 [3,]     1     2     2     1     2     2     1     2     2     2     2     2
 [4,]     1     1     1     1     2     2     1     1     1     1     2     1
 [5,]     1     2     2     1     2     2     1     2     1     1     2     1
 [6,]     1     2     2     1     2     2     1     1     1     1     2     1
 [7,]     1     2     2     2     2     2     1     1     1     1     2     1
 [8,]     1     2     1     1     1     1     1     1     1     1     2     1
 [9,]     1     2     1     1     1     2     1     1     1     1     2     1
      [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37]
 [1,]     1     2     2     1     2     1     2     2     1     2     2     2
 [2,]     1     1     1     1     2     1     2     2     1     2     2     2
 [3,]     2     2     2     1     2     1     2     2     1     2     1     1
 [4,]     1     2     2     1     2     1     2     2     1     2     2     2
 [5,]     1     2     2     1     2     1     1     2     1     2     1     1
 [6,]     1     1     1     1     2     1     1     2     1     2     1     1
 [7,]     1     1     1     1     2     1     1     2     1     2     1     2
 [8,]     1     1     2     1     2     1     1     2     1     2     1     1
 [9,]     2     2     2     1     2     1     1     2     1     2     1     1
      [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49]
 [1,]     2     1     2     1     1     2     1     2     1     1     1     2
 [2,]     2     1     2     2     1     2     1     1     1     2     1     2
 [3,]     2     1     2     2     1     2     1     1     1     2     1     1
 [4,]     2     1     2     1     1     2     1     2     1     2     1     2
 [5,]     2     1     2     1     1     2     1     2     1     2     1     2
 [6,]     2     1     2     1     1     2     1     2     1     2     1     2
 [7,]     2     1     2     1     1     2     1     2     2     2     1     2
 [8,]     2     1     2     1     1     2     1     2     1     2     1     2
 [9,]     2     1     2     1     1     2     1     1     1     2     1     1
      [,50] [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61]
 [1,]     1     2     1     2     1     2     2     1     2     1     2     1
 [2,]     1     2     1     2     1     2     2     1     2     1     2     1
 [3,]     1     2     1     2     1     2     1     1     2     1     2     1
 [4,]     1     1     1     2     1     1     1     1     2     1     2     1
 [5,]     1     2     1     2     1     2     2     1     2     1     2     1
 [6,]     1     2     1     2     1     2     2     1     2     1     2     1
 [7,]     2     2     1     2     2     2     2     1     2     1     2     1
 [8,]     1     2     2     2     1     2     2     1     2     1     2     1
 [9,]     1     2     1     2     2     2     2     1     2     1     2     1
      [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73]
 [1,]     2     1     2     1     2     2     2     1     1     1     1     1
 [2,]     2     1     2     1     2     2     2     2     2     2     2     1
 [3,]     2     1     2     1     2     2     2     2     1     2     2     1
 [4,]     1     1     2     1     2     1     1     1     1     1     1     1
 [5,]     2     1     2     1     2     2     2     2     1     1     2     1
 [6,]     2     1     2     1     1     1     2     2     1     1     2     2
 [7,]     2     1     2     2     2     2     2     2     1     1     1     1
 [8,]     2     1     2     1     2     2     2     2     1     1     2     1
 [9,]     2     1     2     1     2     2     2     2     1     1     2     1
      [,74] [,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85]
 [1,]     1     2     1     2     1     2     1     2     2     1     2     1
 [2,]     1     2     1     2     1     2     1     2     2     1     2     1
 [3,]     1     2     1     2     1     1     1     1     2     1     1     1
 [4,]     1     2     1     2     1     2     1     1     2     1     2     1
 [5,]     1     2     1     2     1     2     1     1     2     1     2     1
 [6,]     2     2     1     2     1     2     1     1     2     1     2     1
 [7,]     1     2     1     2     1     2     1     1     2     1     2     2
 [8,]     1     1     1     2     1     2     1     1     2     1     2     1
 [9,]     2     2     1     2     1     2     1     1     1     1     2     1
      [,86] [,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97]
 [1,]     2     2     2     1     2     2     1     2     1     2     2     1
 [2,]     2     1     2     1     2     2     1     2     1     2     1     1
 [3,]     2     1     2     1     2     2     1     1     1     2     1     1
 [4,]     2     1     2     1     1     2     1     2     1     2     2     1
 [5,]     2     1     2     1     2     2     1     2     1     2     2     1
 [6,]     2     1     2     1     2     2     1     2     1     2     1     1
 [7,]     2     1     2     2     2     2     1     1     1     2     2     1
 [8,]     2     1     2     1     2     2     1     2     1     2     2     1
 [9,]     2     1     2     1     2     2     1     1     1     2     2     1
      [,98] [,99] [,100]
 [1,]     2     1      1
 [2,]     2     1      1
 [3,]     1     1      1
 [4,]     2     1      1
 [5,]     2     1      1
 [6,]     1     1      1
 [7,]     2     2      2
 [8,]     2     2      2
 [9,]     2     2      1

PottsUtils documentation built on May 2, 2019, 6:45 a.m.