Sampling Binary Matrices
The function implements an MCMC algorithm for sampling of binary matrices with fixed margins complying to the Rasch model. Its stationary distribution is uniform. The algorithm also allows for square matrices with fixed diagonal.
rsampler(inpmat, controls = rsctrl())
rsampler
is a wrapper function for a Fortran routine to generate binary random matrices based
on an input matrix.
On output the generated binary matrices are integer encoded. For further
processing of the generated matrices use the function rstats
.
A list of class RSmpl
with components
n |
number of rows of the input matrix |
k |
number of columns of the input matrix |
inpmat |
the input matrix |
tfixed |
|
burn_in |
length of the burn in process |
n_eff |
number of generated matrices (effective matrices) |
step |
controls the number number of void matrices generated in the the burn in
process and when effective matrices are generated (see note
in |
seed |
starting value for the random number generator |
n_tot |
number of matrices in |
outvec |
vector of encoded random matrices |
ier |
error code |
An element of outvec
is a four byte (or 32 bits) integer.
The matrices to be output are stored bitwise (some bits are unused, since a integer is used for every row of a matrix).
So the number of integers per row needed equals (k+31)/32 (integer division), which is one to four in the present implementation since the number of columns and rows must not exceed 128 and 4096, respectively.
The summary method (summary.RSmpl
) prints information on the content of the output object.
Reinhold Hatzinger, Norman Verhelst
Verhelst, N. D. (2008). An Efficient MCMC Algorithm to Sample Binary Matrices with Fixed Marginals. Psychometrika, 73 (4)
data(xmpl) ctr<-rsctrl(burn_in=10, n_eff=5, step=10, seed=0, tfixed=FALSE) res<-rsampler(xmpl,ctr) summary(res)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.