Skip to contents

Generate Artificial Data by Simulation

Usage

datageneration(
  n,
  design = "complete",
  dgp = 1,
  beta_d = 1,
  beta_s = 0,
  Y0 = NULL,
  A = "Erdos-Renyi"
)

Arguments

n

An even number specifying the sample size

design

A character specifying the randomization design. Options are "Bernoulli", "complete", and "stratified", which stand for Bernoulli randomization, complete randomization, and stratified randomization. Default is "complete".

dgp

Specify data generating process 1 or 2 for the outcome equation

beta_d

A scalar specifying the value of a coefficient for the direct effect in the outcome equation. There is no direct effect if beta_d is set to zero.

beta_s

A scalar specifying the value of a coefficient for spillovers in the outcome equation. There are no spillovers if beta_s is set to zero.

Y0

NULL or an n-dimensional vector of the untreated potential outcomes. Default is NULL.

A

An n times n binary adjacency matrix or a character specifying how to generate the adjacency matrix. For the latter case, options are "Erdos-Renyi" and "pairs". Default is "Erdos-Renyi".

Value

A list containing the following elements.

Y

An n-dimensional outcome vector

Z

An n-dimensional treatment assignment vector

A

An n times n binary adjacency matrix

strata

An n-dimensional vector indicating strata

Examples

data <- datageneration(n = 200)