Description Usage Arguments Value Details References See Also Examples
View source: R/estimate_regressions.R
get_muahat
estimates the regression function
E(Y|A = a, X) using the SuperLearner.
1 | get_muahat(y, a, x, newx, aval, ymin, ymax, family = gaussian(), sl.lib)
|
y |
nx1 vector of outcomes in [0, 1] |
a |
nx1 vector of treatments |
x |
nxp |
newx |
qxp |
aval |
Scalar specifying which regression to estimate E(Y|A=aval,X=x) |
ymin |
Infimum of the support of y, so that predictions will be forced to be >= ymin. |
ymax |
Supremum of the support of y, so that predictions will be forced to be <= ymax. |
family |
family specifying the error distribution for outcome
regression, currently |
sl.lib |
character vector specifying which libraries to use for the SL. |
A list containing estimates of E(Y | A = aval, 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_piahat
.
1 2 3 4 5 6 7 8 | 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))
y <- 2 + x$x1 - x$x2 + rnorm(n)
fits <- get_muahat(y, a, x, newx, 1, min(y), max(y), family = gaussian(),
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.