Description Usage Arguments Value Details References See Also Examples
View source: R/estimate_regressions.R
get_piahat
estimates the regression function E(A|X)
using the SuperLearner.
1 | get_piahat(a, x, newx, family = binomial(), trunc_tol = 0.05, sl.lib)
|
a |
nx1 vector of treatments |
x |
nxp |
newx |
qxp |
family |
family specifying the error distribution for treatment
regression, currently only |
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. |
A list containing estimates of E(A|X):
|
nrow( |
|
nrow( |
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.
Van der Laan, M. J., Polley, E. C., & Hubbard, A. E. (2007). Super learner. Statistical applications in genetics and molecular biology, 6(1).
do_crossfit
and get_muahat
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.