# NOT RUN {
# }
# NOT RUN {
neighbors <- getNeighbors(matrix(1, 16, 16), c(2,2,0,0))
blocks <- getBlocks(matrix(1, 16, 16), 2)
spatialMat <- matrix(c(2, 0, -1, 0, 2, 0, -1, 0, 2), ncol=3)
mu <- c(22, 70 ,102)
sigma <- c(17, 16, 19)
count <- c(40, 140, 76)
y <- unlist(lapply(1:3, function(i) rnorm(count[i], mu[i], sigma[i])))
external <- do.call(cbind,
lapply(1:3, function(i) dnorm(y, mu[i],sigma[i])))
current.colors <- rep(1:3, count)
rPotts1(nvertex=16^2, ncolor=3, neighbors=neighbors, blocks=blocks,
spatialMat=spatialMat, beta=0.3, external=external,
colors=current.colors, algorithm="G")
edges <- getEdges(matrix(1, 16, 16), c(2,2,0,0))
rPotts1(nvertex=16^2, ncolor=3, edges=edges, beta=0.3,
external=external, colors=current.colors, algorithm="P")
# }
Run the code above in your browser using DataLab