sim_paneldata: Simulating a panel data for a binary treatment
Description
sim.paneldata generates a panel data set with N cross-sectional units and tt time periods. The data set includes a binary treatment variable, a set of placebo variables, and a set of additional regressors. The data set can be generated under homoskedasticity or heteroskedasticity, and/or AR(1) errors.
Usage
sim_paneldata(
N = 500,
tt = 5,
beta = rep(0, tt),
p = 1,
gamma = rep(1, p),
eta = rep(0, N),
lambda = rep(0, tt),
het = 0,
phi = c(0),
sd = 1,
burnins = 100
)
Value
A data.frame with the following columns:
ID
The cross-sectional unit identifier
period
The time period identifier
Y
The dependent variable
G
The binary treatment variable
X_1, ..., X_p
The additional regressors
Arguments
N
The number of cross-sectional units in the panel-data
tt
The number of time periods in the panel-data
beta
The vector of coefficients for the placebo variables. Must be of size tt.
p
The number of additional regressors
gamma
The vector of coefficients for the additional regressors
eta
The vector of fixed effects. Must be of size N.
lambda
The vector of time effects. Must be of size tt.
het
The heteroskedasticity parameter. Must be 0 or 1: het = 1 indicates that the error terms are generated under heteroskedasticity, het = 0 indicates the error terms are generated under homoscedasticity.
phi
The AR(1) parameter for the error terms. Must be in the interval [0,1).
sd
The standard deviation of the error terms. Must be a positive number.
burnins
The number of burn-ins for the AR(1) process. Must be a positive integer.