Compute variable importance for different groups of variables by comparing the R-squared for the optimally combined outcome.
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, ...)
optWeightObject | An |
---|---|
r2_optWeightObject | An |
Y | The |
X | The |
verbose | A |
grpX | A |
comparison | What type of comparison should be made. Possible choices include
|
parallel | A |
n.cores | A |
seed | The seed to set before each internal call to |
alpha | The function returns a |
... | Other arguments (not currently used) |
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)