generate_data {ablasso} | R Documentation |
Generate a Dataset for Simulations
Description
Generates data according to the following process:
Y_{it} = \alpha_{i} + \gamma_{t} + \theta_{1} Y_{i,t-1} + \theta_{2} D_{it} + \varepsilon_{it}
and
D_{it} = \rho D_{i,t-1} + v_{i,t}
.
Note that D_{it}
is predetermined with respect to \varepsilon_{it}
.
Usage
generate_data(
N,
P,
sigma_alpha = 1,
sigma_gamma = 1,
sigma_eps.d = 1,
sigma_eps.y = 1,
cov_eps = 0.5,
rho = 0.5,
theta = c(0.8, 1),
seed = 202304
)
Arguments
N |
An integer specifying the number of individuals. |
P |
An integer specifying the number of time periods. |
sigma_alpha |
Standard deviation for the normal distribution from which the individual effect |
sigma_gamma |
Standard deviation for the normal distribution from which the time effect |
sigma_eps.d |
Standard deviation for the error term associated with the policy variable/treatment ( |
sigma_eps.y |
Standard deviation for the error term associated with the outcome/response variable ( |
cov_eps |
Covariance between error terms of |
rho |
Autocorrelation coefficient for |
theta |
Regression Coefficients for univariate AR(1) dynamic panal, default |
seed |
Seed for random number generation, default |
Value
A list of two P
x N
matrices named Y
(outcome/response variable) and D
(policy variable/treatment).
Examples
# Generate data using default parameters
data1 <- generate_data(N = 300, P = 40)
str(data1)
data2 <- generate_data(N = 500, P = 20)
str(data2)