aylmer (version 1.0-11)

randomprobs: Probabilities of random boards

Description

Probabilities of a random Markov chain of boards, chosen by the Metropolis-Hastings algorithm

Usage

randomprobs(x, B=2000, n=100, burnin = 0, use.brob=FALSE, func=NULL) randomboards(x, B=2000, n=100, burnin=0) candidate(x, n = 100, give = FALSE)

Arguments

x
Matrix, coerced to class board: the start point
B
Number of samples to take
burnin
Number of samples to discard at the beginning
use.brob
Boolean, with default FALSE meaning to use IEEE arithmetic and TRUE meaning to use Brobdingnagian arithmetic
n
The number of times to try to find a candidate board with no non-negative entries; special value $0$ means to search until one is found
func
In function randomprobs(), the statistic to return; default of NULL interpreted as prob()
give
In function candidate(), Boolean with default FALSE meaning to return a permissible board, and TRUE meaning to return instead the number of attempts made to find a permissible board (zero meaning no board was found). See details section below

Value

Function randomprobs() returns a vector of length B with entries corresponding to the probabilities of the boards encountered.Function randomboards() returns an array with slices being successive boards

References

  • N. A. Metropolis and others 1953. Equation of State Calculations by Fast Computing Machines. Journal of Chemical Physics, 21:1087--1092

See Also

aylmer.test,best

Examples

Run this code
data(chess)
aylmer.test(chess)

a <- matrix(1,9,9)    # See Sloane's A110058
plot(randomprobs(a,1000),type="b",main="Importance of burn-in")

set.seed(0)
b <- diag(rep(6,6))
plot(randomprobs(b,B=1000,n=1000), type="b",main="Importance of burn-in, part II")


data(purum)
randomboards(purum,10)

Run the code above in your browser using DataCamp Workspace