CV.SuperLearner_tidiers | R Documentation |
This method extends tidy
to tidy the results from a
CV.SuperLearner
fit (screening, prediction, or
both) into a summary.
## S3 method for class 'CV.SuperLearner'
tidy(x, ...)
x |
object of class |
... |
Passed through to |
A data.frame
without rownames. Column names included depend
on the supplied value for the optional tidy.SuperLearner
argument algorithm
. See tidy.SuperLearner
for more
details on returned data.frame
. Note that the resulting
data.frame
from tidy.CV.SuperLearner
will contain one
additional column, however: "fold," indicating the (outer) SuperLearner
cross-validation fold number.
tidy.SuperLearner
# based on an example in the SuperLearner package
set.seed(1)
n <- 100
p <- 10
X <- matrix(rnorm(n*p), nrow = n, ncol = p)
X <- data.frame(X)
Y <- rbinom(n, 1, plogis(.2*X[, 1] + .1*X[, 2] - .2*X[, 3] + .1*X[, 3]*X[, 4] - .2*abs(X[, 4])))
library(SuperLearner)
cvsl = CV.SuperLearner(Y, X, family = binomial(),
SL.library = list(c("SL.mean", "screen.FSelector.oneR"),
c("SL.mean", "screen.wgtd.ttest"),
c("SL.glm", "screen.FSelector.oneR"),
c("SL.glm", "screen.wgtd.ttest")),
cvControl = list(V = 2),
innerCvControl = list(list(V = 2)))
library(broom)
tidy(cvsl)
tidy(cvsl, algorithm = "screening")
tidy(cvsl, algorithm = "both")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.