new_formula {ivgets} | R Documentation |
Takes ivreg formula and returns formula compatible with model selection
Description
new_formula
takes a formula object for ivreg::ivreg()
, i.e. in a
format of y ~ x1 + x2 | x1 + z2
, and returns a list with element
suitable for model selection. For example, it updates the data by creating
an intercept if specified in the formula, checks for collinearity among the
regressors, and updates the formula accordingly.
Usage
new_formula(formula, data, keep_exog)
Arguments
formula |
A formula for the ivreg::ivreg function, i.e. in format
|
data |
A data frame. |
keep_exog |
A numeric vector of indices or a character vector of names
corresponding to the exogenous regressors in the |
Value
A list with several named elements. Component $fml
stores the
new baseline formula that will be used for model selection. Components
y
, x
, and z
store the data of the dependent variable,
structural regressors, and excluded instruments. The entries
$depvar
, $x1
, $x2
, $z1
, and $z2
contain
the names of the dependent variable, endogenous and exogenous regressors,
included and excluded instruments. $dx1
, $dx2
, $dz1
,
$dz2
store the dimensions of the respective variables. Finally,
$keep
and $keep.names
contain the indices and names of the
regressors that will not be selected over.