hdm (version 0.3.1)

rlassoEffects: rigorous Lasso for Linear Models: Inference

Description

Estimation and inference of (low-dimensional) target coefficients in a high-dimensional linear model.

Usage

rlassoEffects(x, ...)

# S3 method for default rlassoEffects(x, y, index = c(1:ncol(x)), method = "partialling out", I3 = NULL, post = TRUE, ...)

# S3 method for formula rlassoEffects(formula, data, I, method = "partialling out", included = NULL, post = TRUE, ...)

rlassoEffect(x, y, d, method = "double selection", I3 = NULL, post = TRUE, ...)

Value

The function returns an object of class rlassoEffects with the following entries:

coefficients

vector with estimated values of the coefficients for each selected variable

se

standard error (vector)

t

t-statistic

pval

p-value

samplesize

sample size of the data set

index

index of the variables for which inference is performed

Arguments

x

matrix of regressor variables serving as controls and potential treatments. For rlassoEffect it contains only controls, for rlassoEffects both controls and potential treatments. For rlassoEffects it must have at least two columns.

...

parameters passed to the rlasso function.

y

outcome variable (vector or matrix)

index

vector of integers, logicals or variables names indicating the position (column) of variables (integer case), logical vector of length of the variables (TRUE or FALSE) or the variable names of x which should be used for inference / as treatment variables.

method

method for inference, either 'partialling out' (default) or 'double selection'.

I3

For the 'double selection'-method the logical vector I3 has same length as the number of variables in x; indicates if variables (TRUE) should be included in any case to the model and they are exempt from selection. These variables should not be included in the index; hence the intersection with index must be the empty set. In the case of partialling out it is ignored.

post

logical, if post Lasso is conducted with default TRUE.

formula

An element of class formula specifying the linear model.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which the function is called.

I

An one-sided formula specifying the variables for which inference is conducted.

included

One-sided formula of variables which should be included in any case (only for method="double selection").

d

variable for which inference is conducted (treatment variable)

Details

The functions estimates (low-dimensional) target coefficients in a high-dimensional linear model. An application is e.g. estimation of a treatment effect \(\alpha_0\) in a setting of high-dimensional controls. The user can choose between the so-called post-double-selection method and partialling-out. The idea of the double selection method is to select variables by Lasso regression of the outcome variable on the control variables and the treatment variable on the control variables. The final estimation is done by a regression of the outcome on the treatment effect and the union of the selected variables in the first two steps. In partialling-out first the effect of the regressors on the outcome and the treatment variable is taken out by Lasso and then a regression of the residuals is conducted. The resulting estimator for \(\alpha_0\) is normal distributed which allows inference on the treatment effect. It presents a wrap function for rlassoEffect which does inference for a single variable.

References

A. Belloni, V. Chernozhukov, C. Hansen (2014). Inference on treatment effects after selection among high-dimensional controls. The Review of Economic Studies 81(2), 608-650.

Examples

Run this code
library(hdm); library(ggplot2)
set.seed(1)
n = 100 #sample size
p = 100 # number of variables
s = 3 # nubmer 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"
fm = paste("y ~", paste(colnames(X), collapse="+"))
fm = as.formula(fm)                 
lasso.effect = rlassoEffects(X, y, index=c(1,2,3,50))
lasso.effect = rlassoEffects(fm, I = ~ X1 + X2 + X3 + X50, data=data)
print(lasso.effect)
summary(lasso.effect)
confint(lasso.effect)
plot(lasso.effect)

Run the code above in your browser using DataCamp Workspace