Learn R Programming

RaschSampler (version 0.8.0)

rsampler: Sampling Binary Matrices

Description

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.

Usage

rsampler(inpmat, controls = rsctrl())

Arguments

inpmat
A binary (data) matrix with $n$ rows and $k$ columns.
controls
An object of class RSctr. If not specified, the default parameters as returned by function rsctrl are used.

Value

  • A list of class RSmpl with components
  • nnumber of rows of the input matrix
  • knumber of columns of the input matrix
  • inpmatthe input matrix
  • tfixedTRUE, if diagonals of inpmat are fixed
  • burn_inlength of the burn in process
  • n_effnumber of generated matrices (effective matrices)
  • stepcontrols the number number of void matrices generated in the the burn in process and when effective matrices are generated (see note in rsctrl).
  • seedstarting value for the random number generator
  • n_totnumber of matrices in outvec, n_tot = n_eff + 1
  • outvecvector of encoded random matrices
  • iererror code

Details

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.

References

Verhelst, N. D. (2006) An efficient MCMC-algorithm to sample binary matrices with fixed marginals (under revision)

See Also

rsctrl, rstats

Examples

Run this code
data(xmpl)
ctr<-rsctrl(burn_in=10, n_eff=5, step=10, seed=0, tfixed=FALSE)
res<-rsampler(xmpl,ctr)
summary(res)

Run the code above in your browser using DataLab