generate_param | R Documentation |
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 )
dx1 |
An integer value specifying the number of exogenous regressors.
This should include the intercept if it is present in the model
(see argument |
dx2 |
An integer value specifying the number of endogenous regressors. |
dz2 |
An integer value specifying the number of outside / excluded instruments. |
intercept |
A logical value ( |
beta |
A numeric vector of length |
sigma |
A strictly positive numeric value specifying the standard deviation of the error in the structural model. |
mean_z |
A numeric vector of length |
cov_z |
A numeric positive definite matrix specifying the variance-covariance matrix of the exogenous variables, x1 and z2. |
Sigma2_half |
A numeric positive definite matrix of dimension
|
Omega2 |
A numeric vector of length |
Pi |
A numeric matrix of dimension |
seed |
An integer for setting the seed for the random number generator. |
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
).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.