Function to perform bootstrap on the samples. boot_samples_sgcca
bootstrap given original data, while boot_index_sgcca()
given some
index of samples it iterates over it.
Usage
boot_samples_sgcca(..., nb_boot = 1000, verbose = TRUE)
boot_index_sgcca(index, ..., BPPARAM = BiocParallel::SerialParam())
Arguments
- ...
Named arguments passed to sgcca.
- nb_boot
Number of bootstraps to perform.
- verbose
Logical, should it print a progress bar (default) or not?
- index
A list of numeric values for selecting values
- BPPARAM
Set up parallel backend (see BiocParallel documentation).
Value
A list with two elements: the coefficient of each variable of the input blocks; and the AVE values, both inner, and outer
Details
boot_index_sgcca
Iterate over the index,
which is a list of vectors with the position of samples to use and use sgcca
with the arguments provided.
boot_samples_sgcca
Iterate over random samples without recording which samples where used.
Examples
data("Russett", package = "RGCCA")
X_agric <- as.matrix(Russett[, c("gini", "farm", "rent")])
X_ind <- as.matrix(Russett[, c("gnpr", "labo")])
X_polit <- as.matrix(Russett[ , c("inst", "ecks", "death", "demostab",
"dictator")])
A <- list(X_agric, X_ind, X_polit)
C <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3)
out <- boot_samples_sgcca(A = A, C = C, c1 = rep(1, 3), nb_boot = 10)
#>
|
| | 0%
|
|======= | 10%
|
|============== | 20%
|
|===================== | 30%
|
|============================ | 40%
|
|=================================== | 50%
|
|========================================== | 60%
|
|================================================= | 70%
|
|======================================================== | 80%
|
|=============================================================== | 90%
|
|======================================================================| 100%
head(out$AVE)
#> inner outer
#> [1,] 0.3198515 0.6425860
#> [2,] 0.4556024 0.7002251
#> [3,] 0.4771476 0.6962664
#> [4,] 0.4936660 0.6633783
#> [5,] 0.3921013 0.6420366
#> [6,] 0.4398723 0.6559442
boots <- 10
index <- boot_index(nrow(A[[1]]), boots)
boot_i <- boot_index_sgcca(index, A = A, C = C)