Learn R Programming

hdm (version 0.3.2)

coef.rlassoIV: Coefficients from S3 objects rlassoIV

Description

Method to extract coefficients from objects of class rlassoIV.

Usage

# S3 method for rlassoIV
coef(object, complete = TRUE, selection.matrix = FALSE, ...)

Value

Coefficients obtained from rlassoIV by default. If option selection.matrix is TRUE, a list is returned with final coefficients, a matrix selection.matrix, and a matrix selection.matrixZ: selection.matrix contains the selection index for the lasso regression of y on x (first column) and the lasso regression of the predicted values of d on x

together with the union of these indizes. selection.matrixZ contains the selection index from the first-stage lasso regression of d on z and x.

Arguments

object

an object of class rlassoIV, usually a result of a call rlassoIV with options select.X=TRUE and select.Z=TRUE.

complete

general option of the function coef.

selection.matrix

if TRUE, a selection matrix is returned that indicates the selected variables from each first stage regression. Default is set to FALSE. See section on details for more information.

...

further arguments passed to function coef.

Details

Printing coefficients and selection matrix for S3 object rlassoIV. "x" indicates that a variable has been selected, i.e., the corresponding estimated coefficient is different from zero. The very last column collects all variables that have been selected in at least one of the lasso regressions represented in the selection.matrix. rlassoIV performs three lasso regression steps. A first stage lasso regression of the endogenous treatment variable d on the instruments z and exogenous covariates x, a lasso regression of y on the exogenous variables x, and a lasso regression of the instrumented treatment variable, i.e., a regression of the predicted values of d, on controls x.

Examples

Run this code
if (FALSE) {
data(EminentDomain)
z <- EminentDomain$logGDP$z # instruments
x <- EminentDomain$logGDP$x # exogenous variables
y <- EminentDomain$logGDP$y # outcome varialbe
d <- EminentDomain$logGDP$d # treatment / endogenous variable
lasso.IV = rlassoIV(x=x, d=d, y=y, z=z, select.X=TRUE, select.Z=TRUE) 
coef(lasso.IV) # default behavior
coef(lasso.IV, selection.matrix = T) # print selection matrix
}

Run the code above in your browser using DataLab