reduxB: Reduction of the matrix

Description Usage Arguments Value References Examples

View source: R/redux.R

Description

This function reduces the size of the matrix by removing alternatively columns and rows that have sum equal to 0.

In case where the number of auxiliary varibale is great (p very large), even if we use the fast implementation proposed by (Chauvet and Tillé 2005) the problem is time consuming. If we have the chance that the matrix is strongly sparse, we can then use the function to reduce the size of the matrix B by using this method.

If the matrix is dense or every column have sum greater than 0, then nothing is changed.

Usage

1
reduxB(B)

Arguments

B

a matrix of size (p+1 x p) sub-matrix of auxiliary matrix.

Value

a list

References

Chauvet, G. and Tillé, Y. (2006). A fast algorithm of balanced sampling. Computational Statistics, 21/1:53–62.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Not run: 
#' rm(list = ls())
set.seed(1)
eps <- 1e-13
library(Matrix)
N <- 50
Pik <- matrix(c(sampling::inclusionprobabilities(runif(N),5),
sampling::inclusionprobabilities(runif(N),10),
sampling::inclusionprobabilities(runif(N),15)),ncol = 3)
X <- PM(Pik)$PM
pik <- PM(Pik)$P
dim(X)
order = 2
EPS = 1e-11


p <- ncol(X)
A <-  X/pik
B <- A[1:(p + 1), ]

tmp <- reduxArma(B)
tmp2 <- reduxB(B)
B_redux <- tmp$B
B_redux[1:10,1:20]
B[tmp$ind_row[1:10],tmp$ind_col[1:20]]

## End(Not run)

RJauslin/Sampling documentation built on Aug. 29, 2020, 7:27 a.m.