Function that computes the optimal combination of multiple outcomes and a predictor of the optimal combination using Super Learning.
optWeightEff(Y, X, Z, SL.library.Q, SL.library.g, V = 10, return.SuperLearner = FALSE, select = "effect", seed = 12345, SuperLearner.V = 10, return.IC = TRUE, parallel = FALSE, family = "gaussian", n.cores = parallel::detectCores(), ...)
Y | A |
---|---|
X | A |
Z | A |
SL.library.Q | A |
SL.library.g | A |
V | The number of cross validation folds to use to define parameter. |
return.SuperLearner | A |
select | A |
seed | The seed to set before each internal call to |
SuperLearner.V | The number of CV folds for the |
return.IC | A |
parallel | Not developed yet |
family | An object of class |
n.cores | A |
... | Other arguments |
TO DO: Add return documentation.
# Example 1 -- simple fit set.seed(1234) X <- data.frame(x1=runif(n=500,0,5), x2=runif(n=500,0,5)) Z <- rbinom(500, 1, plogis(-2 + X$x1 + X$x2)) Y1 <- rnorm(500, X$x1 + X$x2 + 1*Z, 1) Y2 <- rnorm(500, X$x1 + X$x2 + 0.25*Z, 1) Y <- data.frame(Y1 = Y1, Y2 = Y2) #example not working yet #fit <- optWeightEff(Y = Y, X = X, Z=Z, SL.library.Q = c("SL.glm","SL.mean"), # SL.library.g = c("SL.glm","SL.mean"))