rkern: R-learner, implemented via kernel ridge regression with a...

Description Usage Arguments Value Examples

View source: R/rkern.R

Description

R-learner, as proposed by Nie and Wager (2017), implemented via kernel ridge regression with a Gaussian kernel

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
rkern(
  x,
  w,
  y,
  k_folds = NULL,
  p_hat = NULL,
  m_hat = NULL,
  b_range = 10^(seq(-3, 3, 0.5)),
  lambda_range = 10^(seq(-3, 3, 0.5))
)

Arguments

x

the input features

w

the treatment variable (0 or 1)

y

the observed response (real valued)

k_folds

number of folds for cross-fitting

p_hat

user-supplied estimate for E[W|X]

m_hat

user-supplied estimte for E[Y|X]

b_range

the range of Gaussian kernel bandwidths for cross validation

lambda_range

the range of ridge regression penalty factor for cross validation

Value

an rkern object

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)

rkern_fit = rkern(x, w, y)
rkern_est = predict(rkern_fit, x)

## End(Not run)

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