coef.rlassoIV | R Documentation |
rlassoIV
Method to extract coefficients from objects of class rlassoIV
.
## S3 method for class 'rlassoIV'
coef(object, complete = TRUE, selection.matrix = FALSE, ...)
object |
an object of class |
complete |
general option of the function |
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. |
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
.
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
.
## Not run:
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
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.