r2_optWeight: r2_optWeight

Description Usage Arguments Value Examples

View source: R/r2.optWeight.R

Description

Estimate the performance of the Super Learner for predicting the optimal weighted combination via cross-validation.

Usage

1
2
3
r2_optWeight(object, Y, X, evalV = 10, return.IC = TRUE, seed = 12345,
  verbose = FALSE, parallel = FALSE, n.cores = parallel::detectCores(),
  ...)

Arguments

object

A optWeight object

Y

The data.frame of outcomes that was used to fit object

X

The data.frame of predictors that was used to fit object

evalV

The number of outer cross validation folds to use to evaluate the predictive performance of object for predicting the optimal combined outcome

return.IC

A boolean indicating whether to return estimated influence function at the observed data values (needed for post-hoc comparisons)

seed

Random seed to set

verbose

A boolean indicating whether to show a progress bar

parallel

A boolean indicating whether to run the CV.SuperLearner calls in parallel using mclapply. Be sure to set options()$mc.cores to

n.cores

A numeric indicating how many cores to use if parallel = TRUE By default will use parallel::detectCores()

...

Other args (not currently used)

Value

An cross-validated estimate of the R-squared for the optimal prediction and standard error and confidence interval.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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)

benkeser/r2weight documentation built on Sept. 16, 2017, 3:28 a.m.