get_piahat: Estimation of regression function E(A|X)

Description Usage Arguments Value Details References See Also Examples

View source: R/estimate_regressions.R

Description

get_piahat estimates the regression function E(A|X) using the SuperLearner.

Usage

1
get_piahat(a, x, newx, family = binomial(), trunc_tol = 0.05, sl.lib)

Arguments

a

nx1 vector of treatments

x

nxp data.frame of covariates

newx

qxp data.frame of values that the regression estimates are evaluated at

family

family specifying the error distribution for treatment regression, currently only binomial() supported. Default is binomial(). Link should not be specified.

trunc_tol

amount of tolerance allowed for truncating the propensity score in [tol, 1 - tol]. Default is 0.05.

sl.lib

character vector specifying which libraries to use for the SL.

Value

A list containing estimates of E(A|X):

testvals

nrow(newx)-dimensional vector containing estimates of regression functions (computed using points x) evaluated at test points newx.

trainvals

nrow(x)-dimensional vector containing estimates of regression functions (computed using points x) evaluated at train points x.

Details

If the SuperLearner returns an error, a GLM is fitted instead. In this case the user is suggested to choose some other method of estimation and then pass the estimates as arguments to other functions. Sometimes SuperLearner returns warnings messages.

References

Van der Laan, M. J., Polley, E. C., & Hubbard, A. E. (2007). Super learner. Statistical applications in genetics and molecular biology, 6(1).

See Also

do_crossfit and get_muahat.

Examples

1
2
3
4
5
6
7
n <- 500
x <- data.frame(x1 = rnorm(n), x2 = runif(n))
newx <- data.frame(x1 = rnorm(20), x2 = runif(20))
a <- rbinom(n, 1, pnorm(x$x1))
fits <- get_piahat(a, x, newx, family = binomial(), 
                   sl.lib = c("SL.mean", "SL.glm", "SL.gam"))
head(fits$testvals)

matteobonvini/sensitivitypuc documentation built on Dec. 9, 2020, 2:24 a.m.