r2_varImp: r2_varImp

Description Usage Arguments Examples

Description

Compute variable importance for different groups of variables by comparing the R-squared for the optimally combined outcome.

Usage

1
2
3
4
r2_varImp(optWeightObject, r2_optWeightObject, Y, X, verbose = FALSE,
  grpX = split(colnames(X), colnames(X)), comparison = c("diff", "ratio"),
  parallel = FALSE, n.cores = parallel::detectCores(), seed = 12345,
  alpha = 0.05, ...)

Arguments

optWeightObject

An optWeight object

r2_optWeightObject

An r2_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

verbose

A boolean indicating whether to show a progress bar

grpX

A list where each entry is a vector of charaters indicating groups of columns of X to remove to test their importance. Defaults to a list of colnames(X)

comparison

What type of comparison should be made. Possible choices include "diff" and "ratio"

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()

seed

The seed to set before each internal call to CV.SuperLearner

alpha

The function returns a (1-alpha)*100 percent confidence interval. Default is set to 0.05 (i.e., 95 percent confidence interval)

...

Other arguments (not currently used)

Examples

1
2
3
4
5
6
7
8
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)
varImp <- r2_varImp(fit, perf.fit, Y = Y, X = X)

benkeser/r2weight documentation built on May 12, 2019, 12:11 p.m.