tlasso: T-learner, implemented via glmnet (lasso)

Description Usage Arguments Examples

View source: R/tlasso.R

Description

T-learner learns the treated and control expected outcome respectively by fitting two separate models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tlasso(
  x,
  w,
  y,
  alpha = 1,
  k_folds_mu1 = NULL,
  k_folds_mu0 = NULL,
  lambda = NULL,
  lambda_choice = c("lambda.min", "lambda.1se"),
  penalty_factor = NULL
)

Arguments

x

the input features

w

the treatment variable (0 or 1)

y

the observed response (real valued)

alpha

tuning parameter for the elastic net

k_folds_mu1

number of folds for cross validation for the treated

k_folds_mu0

number of folds for cross validation for the control

lambda

user-supplied lambda sequence for cross validation

lambda_choice

how to cross-validate; choose from "lambda.min" or "lambda.1se"

penalty_factor

user-supplied penalty factor, must be of length the same as number of features in x

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
n = 100; p = 10

x = matrix(rnorm(n*p), n, p)
w = rbinom(n, 1, 0_5)
y = pmax(x[,1], 0) * w + x[,2] + pmin(x[,3], 0) + rnorm(n)

tlasso_fit = tlasso(x, w, y)
tlasso_est = predict(tlasso_fit, x)

## End(Not run)

xnie/rlearner documentation built on April 11, 2021, 12:49 a.m.