Learn R Programming

hdm (version 0.3.2)

print_coef: Printing coefficients from S3 objects rlassoEffects

Description

Printing coefficients for class rlassoEffects

Usage

print_coef(x, ...)

# S3 method for rlassoEffects print_coef( x, complete = TRUE, selection.matrix = FALSE, include.targets = TRUE, ... )

Arguments

x

an object of class rlassoEffects, usually a result of a call rlassoEffect or rlassoEffects.

...

further arguments passed to functions coef or print.

complete

general option of the function coef.

selection.matrix

if TRUE, a selection matrix is returned that indicates the selected variables from each auxiliary regression. Default is set to FALSE.

include.targets

if FALSE (by default) only the selected control variables are listed in the selection.matrix. If set to TRUE, the selection matrix will also indicate the selection of the target coefficients that are specified in the rlassoEffects call.

Details

Printing coefficients and selection matrix for S3 object rlassoEffects

Examples

Run this code
library(hdm)
set.seed(1)
n = 100 #sample size
p = 100 # number of variables
s = 7 # number of non-zero variables
X = matrix(rnorm(n*p), ncol=p)
colnames(X) <- paste("X", 1:p, sep="")
beta = c(rep(3,s), rep(0,p-s))
y = 1 + X%*%beta + rnorm(n)
data = data.frame(cbind(y,X))
colnames(data)[1] <- "y"
lasso.effect = rlassoEffects(X, y, index=c(1,2,3,50), 
                             method = "double selection")
# without target coefficient estimates
print_coef(lasso.effect, selection.matrix = TRUE) 
# with target coefficient estimates
print_coef(lasso.effect, selection.matrix = TRUE, targets = TRUE) 

Run the code above in your browser using DataLab