Skip to contents

Data generating function

Usage

datageneration(n, tau, HC = FALSE, dimX = 1, DGPY = 1, continuous = TRUE)

Arguments

n

The number of cross-sectional units

tau

The length of time series such that tau > 2

HC

Boolean for whether or not to consider heteroscedastic error terms. If it is TRUE (resp. FALSE), heteroscedastic (resp. homoscedastic) error terms are generated. Default is FALSE.

dimX

The dimension of covariates X. It should be a positive integer. Default is 1.

DGPY

The data generating process for the treated potential outcome equations. Options are 1 and 2. Default is 1.

continuous

Boolean for whether or not to consider a continuous covariate Z. If it is TRUE (resp. FALSE), a continuous (resp. discrete) covariate Z is generated. Default is TRUE.

Value

A data.frame that contains the following elements.

id

The unit index

period

The time period index

Y

The outcome

G

The group

Z

The scalar continuous covariate

X

The other covariates

Examples

set.seed(1)
data <- datageneration(n = 500,
                       tau = 4,
                       HC = FALSE,
                       dimX = 1,
                       DGPY = 1,
                       continuous = TRUE)