Skip to contents

Look for every variation of the models changing the weights by 0.1.

Usage

iterate_model(..., BPPARAM = BiocParallel::SerialParam())

search_model(..., nWeights = 3, BPPARAM = BiocParallel::SerialParam())

Arguments

...

All the same arguments that would be passed to sggca, pass named arguments.

BPPARAM

Set up parallel backend (see BiocParallel documentation).

nWeights

The number of weights used to check the possible designs.

Value

A matrix with the design of the model

Functions

  • search_model: Search for the right model for the blocks provided.

See also

sgcca

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(Agric = X_agric, Ind = X_ind, Polit = X_polit)
C <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3)
out <- search_model(A = A, C = C, c1 =rep(1, 3), scheme = "factorial",
               scale = FALSE, verbose = FALSE,
               ncomp = rep(1, length(A)),
               bias = TRUE, BPPARAM = BiocParallel::SerialParam())
head(out)
#>        vs12       vs13       vs23 AVE_inner AVE_outer        cc1 var12 var13
#> 1 0.3243244 -0.4429347 -0.7464389 0.1506887 0.6668992 0.07534437   0.5   0.5
#> 2 0.3310923 -0.4468592 -0.7481229 0.1396425 0.6649707 0.15954291   1.0   0.5
#> 3 0.3194449 -0.4400412 -0.7451902 0.1631059 0.6681027 0.21914752   0.5   1.0
#> 4 0.3243244 -0.4429347 -0.7464389 0.1506887 0.6668992 0.30137749   1.0   1.0
#> 5 0.3575118 -0.4485234 -0.7713634 0.3614081 0.6533113 0.18070403   0.5   0.0
#> 6 0.3573044 -0.4483754 -0.7712343 0.2833784 0.6534723 0.27636702   1.0   0.0
#>   var23 weights
#> 1   0.0       2
#> 2   0.0       2
#> 3   0.0       2
#> 4   0.0       2
#> 5   0.5       2
#> 6   0.5       2
# From all the models, we select that with the higher inner AVE:
model <- extract_model(C, out, "inner")
# We then look for a variation of the weights of this model
out <- iterate_model(A = A, C = model, c1 =rep(1, 3), scheme = "factorial",
               scale = FALSE, verbose = FALSE,
               ncomp = rep(1, length(A)),
               bias = TRUE)