Generate a design matrix X by sampling from a real-world data matrix.
generate_X_rwd.Rd
Generate a design matrix X by sampling from a real-world data matrix under the specified sampling scheme.
Arguments
- X
Data matrix or data frame.
- n
Number of samples if
clusters
is notNULL
. Ifclusters = NULL
, this is the number of clusters.- p
Number of features. If
p < ncol(X)
, thep
features are sampled uniformly at random from the full feature set.- clusters
(Optional) Vector of cluster IDs. If provided, block or clustered sampling will be performed according to these clusters so that each cluster will be entirely in or entirely out of the retrieved sample.
- replace
Logical. If TRUE, sample observations with replacement; if FALSE, sample observations without replacement