[Vegan-commits] r549 - in pkg: inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 2 21:38:00 CET 2008
Author: psolymos
Date: 2008-11-02 21:38:00 +0100 (Sun, 02 Nov 2008)
New Revision: 549
Modified:
pkg/inst/ChangeLog
pkg/man/permatfull.Rd
Log:
quasiswapcount entry is added to changelog
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2008-11-02 20:24:31 UTC (rev 548)
+++ pkg/inst/ChangeLog 2008-11-02 20:38:00 UTC (rev 549)
@@ -4,6 +4,13 @@
Version 1.16-4 (opened November 1, 2008)
+ * permatwsap: quasiswap method is implemented for count data
+ based on the idea of Carsten Dormann in the swap.web::bipartite
+ function. This takes a random matrix first with same row and
+ column sums as the original (via r2dtable), and than restores
+ the original matrix fill through steps of swaping 2x2
+ submatrices. The current R code is slow.
+
* permatfull: when both cells and individuals are shuffled,
the matrix fill remains constant.
Modified: pkg/man/permatfull.Rd
===================================================================
--- pkg/man/permatfull.Rd 2008-11-02 20:24:31 UTC (rev 548)
+++ pkg/man/permatfull.Rd 2008-11-02 20:38:00 UTC (rev 549)
@@ -64,7 +64,7 @@
For count data, a special swap algorithm ('swapcount') is implemented that results in permuted matrices with
fixed marginals and matrix fill at the same time.
-The 'quasiswapcount' algorithm (\code{method="quasiswap"} and \code{mtype="count"}) uses the same trick as Carsten Dorman's \code{swap.web} function in the package 'bipartite'. First, a random matrix is generated by the \code{\link{r2dtable}} function retaining row and column sums. Than the original matrix fill is reconstructed by sequential steps to increase or decrease matrix fill in the random matrix. These steps are based on swaping 2x2 submatrices (see 'swapcount' algorithm for details) to maintain row and column totals. This algorithm generates independent matrices in each step, so \code{burnin} and \code{thin} arguments are not considered. (At the moment this option is not implemented in C, thus quite slow.)
+The 'quasiswapcount' algorithm (\code{method="quasiswap"} and \code{mtype="count"}) uses the same trick as Carsten Dormann's \code{\link[bipartite]{swap.web}} function in the package 'bipartite'. First, a random matrix is generated by the \code{\link{r2dtable}} function retaining row and column sums. Than the original matrix fill is reconstructed by sequential steps to increase or decrease matrix fill in the random matrix. These steps are based on swaping 2x2 submatrices (see 'swapcount' algorithm for details) to maintain row and column totals. This algorithm generates independent matrices in each step, so \code{burnin} and \code{thin} arguments are not considered. (At the moment this option is not implemented in C, thus quite slow.)
The 'swapcount' algorithm (\code{method="swap"} and \code{mtype="count"}) tries to find 2x2 submatrices (identified by 2 random row and 2 random column indices), that can be swapped in order to leave column and row totals and fill unchanged. First, the algorithm finds the largest value in the submatrix that can be swapped ($d$) and whether in diagonal or antidiagonal way. Submatrices that contain values larger than zero in either diagonal or antidiagonal position can be swapped. Swap means that the values in diagonal or antidiagonal positions are decreased by $d$, while remaining cells are increased by $d$. A swap is made only if fill doesn't change. This algorithm is sequential, subsequent matrices are not independent, because swaps modify little if the matrix is large. In these cases many burnin steps and thinning is needed to get independent random matrices. This algorithm is implemented in C for speed, but large burmin and thin values can slow it down considerably.
More information about the Vegan-commits
mailing list