Add names to data returned by rgcca
or sgcca
, simplify AVE output
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)
A <- lapply(A, function(x) scale2(x, bias = TRUE))
C <- matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3)
out <- RGCCA::rgcca(A, C, tau = rep(0, 3), scheme = "factorial",
scale = FALSE, verbose = FALSE, ncomp = rep(2, length(A)))
out$AVE
#> $AVE_X
#> $AVE_X[[1]]
#> comp1 comp2
#> 0.2696404 0.5907840
#>
#> $AVE_X[[2]]
#> comp1 comp2
#> 0.8956496 0.1043504
#>
#> $AVE_X[[3]]
#> comp1 comp2
#> 0.4387091 0.1647263
#>
#>
#> $AVE_outer_model
#> [1] 0.4793766 0.2804684
#>
#> $AVE_inner_model
#> [1] 0.4834515 0.1338607
#>
out <- improve(out, c("Agric", "Ind", "Polit"))
out$AVE
#> $AVE_X
#> Agric Ind Polit
#> comp1 0.2696404 0.8956496 0.4387091
#> comp2 0.5907840 0.1043504 0.1647263
#>
#> $AVE_outer_model
#> [1] 0.4793766 0.2804684
#>
#> $AVE_inner_model
#> [1] 0.4834515 0.1338607
#>