RaschSampler {eRm} | R Documentation |
Rasch Sampler Package
Description
The package 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.
Parameter estimates in the Rasch model only depend on the marginal totals of
the data matrix that is used for the estimation. From this it follows that, if the
model is valid, all binary matrices with the same marginals as the observed one
are equally likely. For any statistic of the data matrix, one can approximate
the null distribution, i.e., the distribution if the Rasch model is valid, by taking
a random sample from the collection of equally likely data matrices and constructing
the observed distribution of the statistic.
One can then simply determine the exceedence probability of the statistic in the
observed sample, and thus construct a non-parametric test of the Rasch model.
The main purpose of this package is the implementation of a methodology to build nonparametric
tests for the Rasch model.
In the context of social network theories, where the structure of binary asymmetric
relations is studied, for example,
person a
esteems person b
, which correponds to a 1 in cell (a, b)
of the associated adjacency matrix. If one wants to study
the distribution of a statistic defined on the adjacency matrix and conditional
on the marginal totals, one has to exclude the diagonal cells from consideration, i.e.,
by keeping the diagonal cells fixed at an arbitrary value. The RaschSampler
package
has implemented an appropriate option, thus it can be also used for sampling random adjacency
matrices with given marginal totals.
Details
Package: | RaschSampler |
Type: | Package |
Version: | 0.8-6 |
Date: | 2012-07-03 |
License: | GNU GPL 2, June 1991 |
The user has to supply a binary input matrix. After defining appropriate control
parameters using rsctrl
the sampling function rsampler
may be called to obtain an object of class RSmpl
which contains the
generated random matrices in encoded form. After defining an appropriate function
to operate on a binary matrix (e.g., calculate a statistic such as phi.range
)
the application of this function to the sampled matrices is performed
using rstats
. Prior to applying the user defined function, rstats
decodes the matrices packed in the RSmpl
-object.
The package also defines a utility function rsextrobj
for extracting certains parts from
the RSmpl
-object resulting in an object of class RSmplext
.
Both types of objects can be saved and reloaded for later use.
Summary methods are available to print information on these objects, as well as
on the control object RSctr
which is obtained from using
rsctrl
containing the specification for the sampling routine.
Note
The current implementation allows for data matrices up to 4096 rows and 128 columns.
This can be changed by setting nmax
and kmax
in RaschSampler.f90
to values which are a power of 2. These values should also be changed in rserror.R
.
For convenience, we reuse the Fortran code of package version 0.8-1 which cicumvents the
compiler bug in Linux distributions of GCC 4.3. The following note from package version 0.8-3
is thus obsolete:
In case of compilation errors (due to a bug in Linux distributions of GCC 4.3) please use
RaschSampler.f90
from package version 0.8-1 and change nmax
and kmax
accordingly (or use GCC 4.4).
Author(s)
Reinhold Hatzinger, Patrick Mair, Norman D. Verhelst
References
Verhelst, N. D. (2008) An Efficient MCMC Algorithm to Sample Binary Matrices with Fixed Marginals. Psychometrika, Volume 73, Number 4
Verhelst, N. D., Hatzinger, R., and Mair, P. (2007) The Rasch Sampler, Journal of Statistical Software, Vol. 20, Issue 4, Feb 2007