Description Usage Arguments Value Note Author(s) References See Also Examples
Probabilities of a random Markov chain of boards, chosen by the Metropolis-Hastings algorithm
1 2 3 | 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)
|
x |
Matrix, coerced to class |
B |
Number of samples to take |
burnin |
Number of samples to discard at the beginning |
use.brob |
Boolean, with default |
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 |
give |
In function |
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
Argument n
of function candidate()
specifies how many
times to search for a board with no non-negative entries. The special
value n=0
means to search until one is found.
Boards with a large number of zeros may require more than the default
100 attempts to find a permissible board. Set the give
flag to
see how many candidates are generated before a permissible one is found.
Warning: a board with at most one entry greater than zero is
the unique permissible board and the algorithm will not terminate if
n=0
A board that requires more than 100 attempts is probably well-suited
to the exact test as permissible boards will likely be enumerable
using allboards()
.
To find the permissible board that maximizes some objective function,
use best()
, which applies the bespoke optimization routines of
optim()
Robin K. S. Hankin (R); Luke J. West (C++)
N. A. Metropolis and others 1953. Equation of State Calculations by Fast Computing Machines. Journal of Chemical Physics, 21:1087–1092
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.