sim_dgp {estimateW} | R Documentation |
Simulating from a data generating process
Description
This function can be used to generate data from a data generating process for SDM, SAR, SLX type models.
Usage
sim_dgp(
n,
tt,
rho,
beta1 = c(),
beta2 = c(),
beta3 = c(),
sigma2,
n_neighbor = 4,
do_symmetric = FALSE,
intercept = FALSE
)
Arguments
n |
Number of spatial observations |
tt |
Number of time observations |
rho |
The true |
beta1 |
Vector of dimensions |
beta2 |
Vector of dimensions |
beta3 |
Vector of dimensions |
sigma2 |
The true |
n_neighbor |
Number of neighbors for the generated |
do_symmetric |
Should the generated spatial weight matrix be symmetric? (default: FALSE) |
intercept |
Should the first column of |
Details
The generated spatial panel model takes the form
with . he function generates the
vector
.
The elements of the explanatory variable matrices
(
) and
(
) are randomly generated from a Gaussian
distribution with zero mean and unity variance (
).
The non-negative, row-stochastic by
matrix
is constructed using a k-nearest neighbor specification
based on a randomly generated spatial location pattern, with coordinates sampled from a standard normal distribution.
Values for the parameters ,
, and
, as well as
and
have to be provided by the user. The length of
and
have to be equal.
A spatial Durbin model (SDM) is constructed if
is not equal to zero and
,
, and
are all supplied by the user.
A spatial autoregressive model is constructed if
is not equal to zero and only
is supplied by the user.
An SLX type model is constructed if
is equal to zero and
,
are supplied by the user.
Value
A list with the generated ,
and
and a list of parameters.
Examples
# SDM data generating process
dgp_dat = sim_dgp(n =20, tt = 10, rho = .5, beta1 = c(1,-1),
beta2 = c(0,.5),beta3 = c(.2),sigma2 = .5)