findB {StratifiedSampling} | R Documentation |
Find best sub-matrix B in stratifiedcube
Description
This function is computing a sub-matrix used in stratifiedcube
.
Usage
findB(X, strata)
Arguments
X |
A matrix of size ( |
strata |
A vector of integers that specifies the stratification. |
Details
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.
Value
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.
Examples
N <- 1000
strata <- sample(x = 1:6, size = N, replace = TRUE)
p <- 3
X <- matrix(rnorm(N*p),ncol = 3)
findB(X,strata)
[Package StratifiedSampling version 0.4.2 Index]