predict.xlasso: predict for xlasso

Description Usage Arguments Value Examples

View source: R/xlasso.R

Description

get estimated tau(x) using the trained xlasso model

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'xlasso'
predict(
  object,
  newx = NULL,
  new_p_hat = NULL,
  s = c("lambda.min", "lambda.1se"),
  ...
)

Arguments

object

a xlasso object

newx

covariate matrix to make predictions on. If null, return the tau(x) predictions on the training data

new_p_hat

propensity score on newx provided by the user. Default to NULL. If the user provided their own propensity p_hat in training, new_p_hat must be provided here.

s

choose from "lambda.min" or "lambda.1se

...

additional arguments (currently not used)

Value

vector of predictions

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)

xlasso_fit = xlasso(x, w, y)
xlasso_est = predict(xlasso_fit, x)

## End(Not run)

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