NA
entries specify structural
zeros. Function allboards()
takes a matrix x
, coerces
it to a board, then enumerates all boards with identical marginal
totals, and zeros at the same locations as the structural zeros of
x
.no.of.boards(x, n = 1e5)
allboards(x, n = 1e5)
allprobs(x, n = 1e5, normalize=TRUE, give.log=FALSE, use.C=TRUE)
is.1dof(x)
maxlike(x)
NA
entriesallprobs()
, Boolean with default
TRUE
meaning to use the C
routine, and FALSE
meaning to use an R
routineallprobs()
, Boolean with default
TRUE
meaning to normalize the returned values so they sum to
one (and thus correspond to probabilities conditional on the
marginal totals and structural zeros)no.of.boards(x)
returns the number of boards with
non-negative entries that have the same marginal totals as x
and structural zeros where x
has NA
entries (that is,
permissible boards). Function allboards()
enumerates
such boards. Function prob(x)
returns a number proportional to the
probability of observing x
, given the structural zeros and
marginal total.
Function is.1dof(x)
returns TRUE
if and only if x
is of the same form as gear
, and thus has only one degree of
freedom. Note that there exist other configurations which have only
one degree of freedom (such as any permutation of the rows and columns
of gear
).
Function maxlike(x)
returns the entry of allboards()
that has the highest probabliity of occurring. Compare best
.
In functions no.of.boards()
and allboards()
, argument
n
is the maximum number of boards (or maximum count) returned,
except for special value 0
, which means to return (or count)
all possible boards. Warning: many frequently-encountered
boards have a very large number of possible configurations, and if
called with n=0
, these functions will iterate for a
very long time before stopping.
marginals
,aylmer.test
,best
data(chess)
allboards(chess)
maxlike(chess)
data(frogs)
x <- matrix(c(28,2,9,7,3,1,14,34,9,8,6,2),ncol=2)
no.of.boards(x) # Should be 339314 according to Gail and Mantel
Run the code above in your browser using DataLab