sreg.rgen: Generate a Pseudo-Random Sample under the Stratified Block...

View source: R/core.R

sreg.rgenR Documentation

Generate a Pseudo-Random Sample under the Stratified Block Randomization Design

Description

The function generates the observed outcomes, treatment assignments, strata indicators, cluster indicators, cluster sizes, and covariates for estimating the treatment effect within the context of a stratified block randomization design under the covariate-adaptive randomization (CAR).

Usage

sreg.rgen(
  n,
  Nmax = 50,
  n.strata = 10,
  tau.vec = c(0),
  gamma.vec = c(0.4, 0.2, 1),
  cluster = TRUE,
  is.cov = TRUE,
  small.strata = FALSE,
  k = 3,
  treat.sizes = c(1, 1, 1)
)

Arguments

n

a total number of observations in a sample

Nmax

a maximum size of generated clusters (maximum number of observations in a cluster)

n.strata

an integer specifying the number of strata

tau.vec

a numeric 1 \times |\mathcal A| vector of treatment effects, where |\mathcal A| represents the number of treatments

gamma.vec

a numeric 1 \times 3 vector of parameters corresponding to covariates

cluster

a TRUE/FALSE argument indicating whether the dgp should use a cluster-level treatment assignment or individual-level

is.cov

a TRUE/FALSE argument indicating whether the dgp should include covariates or not

small.strata

a TRUE/FALSE argument indicating whether the data-generating process should use a small-strata design (e.g., matched pairs, n-tuples)

k

an integer specifying the number of units per stratum when small.strata = TRUE

treat.sizes

a numeric 1 \times (|\mathcal A| + 1) vector specifying the number of units assigned to each treatment within a stratum; the first element corresponds to control units (D = 0), the second to the first treatment (D = 1), and so on

Value

An object that is a 'data.frame' with n observations containing the generated values of the following variables:

  • Y: a numeric n \times 1 vector of observed outcomes

  • S: a numeric n \times 1 vector of strata indicators

  • D: a numeric n \times 1 vector of treatments indexed by \{0, 1, 2, \ldots\}, where \code{D} = 0 denotes the control

  • G.id: a numeric n \times 1 vector of cluster indicators

  • X: a data.frame with columns representing the covariate values for every observation

Examples

data <- sreg.rgen(n = 1000, tau.vec = c(0), n.strata = 4, cluster = TRUE)

sreg documentation built on Aug. 25, 2025, 5:14 p.m.