View source: R/rlassoIVselectX.R
coef.rlassoIVselectX | R Documentation |
rlassoIVselectX
Method to extract coefficients and selection matrix from objects of class rlassoIVselectX
.
## S3 method for class 'rlassoIVselectX'
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 regression. Default is set to FALSE. See section on details for more information. |
... |
further arguments passed to functions coef. |
Printing coefficients and selection matrix for S3 object rlassoIVselectX
. The first column of the selection matrix reports the selection index for the lasso regression of y
on x
in the specified
rlassoIVselectX
command. "x"
indicates that a variable has been selected, i.e., the corresponding estimated coefficient is different from zero.
The second column contains the selection index for the lasso regression of d
on x
and the remaining columns
the index of selected variables x
for the instruments z
. The very last column collects all variables that have been selected in at least one of the lasso regressions.
## Not run:
library(hdm)
data(AJR); y = AJR$GDP; d = AJR$Exprop; z = AJR$logMort
x = model.matrix(~ -1 + (Latitude + Latitude2 + Africa +
Asia + Namer + Samer)^2, data=AJR)
AJR.Xselect = rlassoIV(GDP ~ Exprop + (Latitude + Latitude2 + Africa + Asia + Namer + Samer)^2 |
logMort + (Latitude + Latitude2 + Africa + Asia + Namer + Samer)^2,
data=AJR, select.X=TRUE, select.Z=FALSE)
coef(AJR.Xselect) # Default behavior
coef(AJR.Xselect, selection.matrix = TRUE) # print selection matrix
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.