extract_formula: Extract the elements of ivreg formula

View source: R/utility.R

extract_formulaR Documentation

Extract the elements of ivreg formula

Description

extract_formula takes a formula object for ivreg, i.e. in a format of y ~ x1 + x2 | x1 + z2 and extracts the different elements in a list. Each element is a character vector storing the different types of regressors. Element y_var refers to the dependent variable, x1_var to the exogenous regressors, x2_var to the endogenous regressors, z1_var to the exogenous regressors (which have to be included again as instruments and hence coincide with x1_var), and z2_var refers to the outside instruments.

Usage

extract_formula(formula)

Arguments

formula

A formula for the ivreg function, i.e. in format y ~ x1 + x2 | z1 + z2.

Value

extract_formula returns a list with five named components, each of which is a character vector: $y_var refers to the dependent variable, $x1_var to the exogenous regressors, $x2_var to the endogenous regressors, $z1_var to the exogenous regressors (which have to be included again as instruments and hence coincide with $x1_var), and $z2_var refers to the outside instruments.


robust2sls documentation built on Jan. 11, 2023, 5:13 p.m.