Estimate the performance of the Super Learner for predicting the optimal weighted combination via cross-validation.
r2_optWeight(object, Y, X, evalV = 10, return.IC = TRUE, seed = 12345, verbose = FALSE, parallel = FALSE, n.cores = parallel::detectCores(), ...)
object | A |
---|---|
Y | The |
X | The |
evalV | The number of outer cross validation folds to use to evaluate the predictive
performance of |
return.IC | A |
seed | Random seed to set |
verbose | A |
parallel | A |
n.cores | A |
... | Other args (not currently used) |
An cross-validated estimate of the R-squared for the optimal prediction and standard error and confidence interval.
# Example 1 -- simple fit set.seed(1234) X <- data.frame(x1=runif(n=100,0,5), x2=runif(n=100,0,5)) Y1 <- rnorm(100, X$x1 + X$x2, 1) Y2 <- rnorm(100, X$x1 + X$x2, 3) Y <- data.frame(Y1 = Y1, Y2 = Y2) fit <- optWeight(Y = Y, X = X, SL.library = c("SL.glm","SL.mean"), family = "gaussian",outerV = 10, return.CV.SuperLearner = FALSE) perf.fit <- r2_optWeight(object = fit, Y = Y, X = X, evalV = 5)