generateGroupIDsInSimulator {batchmix} | R Documentation |
Generate group IDs
Description
Generate group IDs within “generateBatchData“.
Usage
generateGroupIDsInSimulator(
N,
K,
B,
batch_IDs,
group_weights,
varying_group_within_batch
)
Arguments
N |
The number of items (rows) to generate. |
K |
The number of groups to genetare. |
B |
The number of batches present in “batch_IDs“. |
batch_IDs |
The batch membership of each item. |
group_weights |
One of either a K x B matrix of the expected proportion of each batch in each group or a K-vector of the expected proportion of the entire dataset in each group. |
varying_group_within_batch |
Flag indicating if the groups are vvarying across batches. |
Value
A N-vector of group membership.
Examples
N <- 500
K <- 2
B <- 5
group_weights <- rep(1 / K, K)
batch_weights <- rep(1 / B, B)
batch_IDs <- sample(seq(1, B), N, replace = TRUE, prob = batch_weights)
varying_group_within_batch <- FALSE
group_IDs <- generateGroupIDsInSimulator(
N,
K,
B,
batch_IDs,
group_weights,
varying_group_within_batch
)
[Package batchmix version 2.2.1 Index]