D_regularized(
data = iris[iris$Species == "setosa" | iris$Species == "versicolor", ],
mv.vars = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"),
group.var = "Species", group.values = c("setosa", "versicolor")
)$D
# out-of-bag predictions
D_regularized(
data = iris[iris$Species == "setosa" | iris$Species == "versicolor", ],
mv.vars = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"),
group.var = "Species", group.values = c("setosa", "versicolor"),
out = TRUE, size = 15, pcc = TRUE, auc = TRUE
)$D
# separate sample folds
# generate data for 10 groups
set.seed(34246)
n1 <- 100
n2 <- 10
d <-
data.frame(
sex = sample(c("male", "female"), n1 * n2, replace = TRUE),
fold = sample(x = LETTERS[1:n2], size = n1 * n2, replace = TRUE),
x1 = rnorm(n1 * n2),
x2 = rnorm(n1 * n2),
x3 = rnorm(n1 * n2)
)
# Fit and predict with same data
D_regularized(
data = d,
mv.vars = c("x1", "x2", "x3"),
group.var = "sex",
group.values = c("female", "male"),
fold.var = "fold",
fold = TRUE,
rename.output = TRUE
)$D
# Out-of-bag data for each fold
D_regularized(
data = d,
mv.vars = c("x1", "x2", "x3"),
group.var = "sex",
group.values = c("female", "male"),
fold.var = "fold",
size = 17,
out = TRUE,
fold = TRUE,
rename.output = TRUE
)$D
Run the code above in your browser using DataLab