coef.rlassoIVselectX: Coefficients from S3 objects 'rlassoIVselectX'

View source: R/rlassoIVselectX.R

coef.rlassoIVselectXR Documentation

Coefficients from S3 objects rlassoIVselectX

Description

Method to extract coefficients and selection matrix from objects of class rlassoIVselectX.

Usage

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

Arguments

object

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

complete

general option of the function coef.

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.

Details

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.

Examples

## 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)

hdm documentation built on May 29, 2024, 3:35 a.m.