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 y ~ x1 + x2 | z1 + z2.

data

A data frame.

keep_exog

A numeric vector of indices or a character vector of names corresponding to the exogenous regressors in the data that should not be selected over. Default NULL means that selection is over all exogenous regressors. If an intercept has been specified in the formula but is not already included in the data, then it can be kept by either including the index 0 or the character "Intercept", respectively, as an element in keep_exog.

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.


[Package ivgets version 0.1.2 Index]