By default, generate_param
creates random parameters of a 2SLS model
that satisfy conditions for 2SLS models, such as positive definite
variance-covariance matrices. The user can also specify certain parameters
directly, which are then checked for their validity.
generate_param(
dx1,
dx2,
dz2,
intercept = TRUE,
beta = NULL,
sigma = 1,
mean_z = NULL,
cov_z = NULL,
Sigma2_half = NULL,
Omega2 = NULL,
Pi = NULL,
seed = 42
)
generate_param
returns a list with the (randomly created or
user-specified) parameters that are required for drawing random data that.
The parameters are generated to fulfill the 2SLS model assumptions.
$structural
A list with two components storing the mean
($mean
) and variance-covariance matrix ($cov
) for the
structural error (u), the random first stage errors (r2), and all
instruments (excluding the intercept since it is not random) (z).
$params
A list storing the parameters of the 2SLS model.
$beta
is the coefficient vector (including intercept if present) of
the structural equation, $Pi
the coefficient matrix of the first
stage projections, $Omega2
the covariance between the structural
error and the endogenous first stage errors, $Sigma2_half
the square
root of the variance-covariance matrix of the endogenous first stage
errors, $mean_z
the mean of all instruments (excluding the intercept
since it is not random), $cov_z
the variance-covariance matrix of
the endogenous first-stage errors, $Ezz
the expected value of the
squared instruments.
$settings
A list storing the function call ($call
),
whether an intercept is included in the model ($intercept
), a
regression formula for the model setup ($formula
), and the
dimensions of the regressors and instruments ($dx1
, $dx2
,
$dz2
.
$names
A list storing generic names for the regressors,
instruments, and errors as character vectors ($x1
, $x2
,
$x
, $z2
, $z
, $r
, and $u
).
An integer value specifying the number of exogenous regressors.
This should include the intercept if it is present in the model
(see argument intercept
).
An integer value specifying the number of endogenous regressors.
An integer value specifying the number of outside / excluded instruments.
A logical value (TRUE
/ FALSE
) indicating
whether the model should contain an intercept.
A numeric vector of length dx1 + dx2
specifying the
parameters of the structural equation.
A strictly positive numeric value specifying the standard deviation of the error in the structural model.
A numeric vector of length dx1 + dz2
specifying the mean
of the exogenous variables, x1 and z2.
A numeric positive definite matrix specifying the variance-covariance matrix of the exogenous variables, x1 and z2.
A numeric positive definite matrix of dimension
dx2
by dx2
such that its square is the variance-covariance
matrix of the random first stage errors (Sigma2).
A numeric vector of length dx1
specifying the
correlation between the scaled random first stage error and the structural
error.
A numeric matrix of dimension (dx1 + dz2)
by
(dx1 + dx2)
specifying the first stage parameter matrix.
An integer for setting the seed for the random number generator.