sim_DGP {PAGFL} | R Documentation |
Simulate a Panel With a Group Structure in the Slope Coefficients
Description
Construct a static or dynamic, exogenous or endogenous panel data set subject to a group structure in the slope coefficients with optional or
innovations.
Usage
sim_DGP(
N = 50,
n_periods = 40,
p = 2,
n_groups = 3,
group_proportions = NULL,
error_spec = "iid",
dynamic = FALSE,
dyn_panel = lifecycle::deprecated(),
q = NULL,
alpha_0 = NULL
)
Arguments
N |
the number of cross-sectional units. Default is 50. |
n_periods |
the number of simulated time periods |
p |
the number of explanatory variables. Default is 2. |
n_groups |
the number of groups |
group_proportions |
a numeric vector of length |
error_spec |
options include
Default is |
dynamic |
Logical. If |
dyn_panel |
|
q |
the number of exogenous instruments when a panel with endogenous regressors is to be simulated. If panel data set with exogenous regressors is supposed to be generated, pass |
alpha_0 |
a |
Details
The scalar dependent variable is generated according to the following grouped panel data model
represents individual fixed effects and
a
vector of regressors.
The individual slope coefficient vectors
are subject to a group structure
with ,
and
for any
,
. The total number of groups
is determined by
n_groups
.
If a panel data set with exogenous regressors is generated (set q = NULL
), the explanatory variables are simulated according to
where denotes a series of innovations.
and
are independent of each other.
In case alpha_0 = NULL
, the group-level slope parameters are drawn from
.
If a dynamic panel is specified (dynamic = TRUE
), the coefficients
are drawn from a uniform distribution with support
and
.
Moreover, the individual fixed effects enter the dependent variable via
to account for the autoregressive dependency.
We refer to Mehrabani (2023, sec 6) for details.
When specifying an endogenous panel (set q
to ), the
correlate with the cross-sectional innovations
by a magnitude of 0.5 to produce endogenous regressors (
). However, the endogenous regressors can be accounted for by exploiting the
instruments in
, for which
holds.
The instruments and the first stage coefficients are generated in the same fashion as
and
when
q = NULL
.
The function nests, among other, the DGPs employed in the simulation study of Mehrabani (2023, sec. 6).
Value
A list holding
alpha |
the |
groups |
a vector indicating the group memberships |
y |
a |
X |
a |
Z |
a |
data |
a |
Author(s)
Paul Haimerl
References
Mehrabani, A. (2023). Estimation and identification of latent group structures in panel data. Journal of Econometrics, 235(2), 1464-1482. doi:10.1016/j.jeconom.2022.12.002.
Examples
# Simulate DGP 1 from Mehrabani (2023, sec. 6)
alpha_0_DGP1 <- matrix(c(0.4, 1, 1.6, 1.6, 1, 0.4), ncol = 2)
DGP1 <- sim_DGP(
N = 50, n_periods = 20, p = 2, n_groups = 3,
group_proportions = c(.4, .3, .3), alpha_0 = alpha_0_DGP1
)