findB | R Documentation |
This function is computing a sub-matrix used in stratifiedcube
.
findB(X, strata)
X |
A matrix of size (N x p) of auxiliary variables on which the sample must be balanced. |
strata |
A vector of integers that specifies the stratification. |
The function finds the smallest matrix B such that it contains only one more row than the number of columns. It consecutively adds the right number of rows depending on the number of categories that is added.
A list of two components. The sub-matrix of X
and the corresponding disjunctive matrix.
If we use the function cbind
to combine the two matrices, the resulting matrix has only one more row than the number of columns.
Raphaël Jauslin raphael.jauslin@unine.ch
N <- 1000 strata <- sample(x = 1:6, size = N, replace = TRUE) p <- 3 X <- matrix(rnorm(N*p),ncol = 3) findB(X,strata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.