Skip to contents

Performs calculations to the output of sgcca to make it easier to retrieve the information about the result.

Usage

analyze(sgcca)

Arguments

sgcca

SGCCA object from the RGCCA package

Value

A vector with the correlation between components, AVE (both inner and outer), the canonical correlation, the weight in the design matrix, and the number of interactions that exists.

Details

Calculates the correlations between the canonical dimensions, calculates the canonical correlations, returns also the weight of each link of the model used, all of this in a tidy way.

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 = TRUE)
#> Computation of the RGCCA block components based on the factorial scheme 
#> Shrinkage intensity paramaters are chosen manually 
#>  Iter:    1  Fit: 1.83005079  Dif:  0.38803933 
#>  Iter:    2  Fit: 1.92003517  Dif:  0.08998438 
#>  Iter:    3  Fit: 1.93192442  Dif:  0.01188925 
#>  Iter:    4  Fit: 1.93354278  Dif:  0.00161836 
#>  Iter:    5  Fit: 1.93376871  Dif:  0.00022593 
#>  Iter:    6  Fit: 1.93380060  Dif:  0.00003189 
#>  Iter:    7  Fit: 1.93380512  Dif:  0.00000452 
#>  Iter:    8  Fit: 1.93380576  Dif:  0.00000064 
#>  Iter:    9  Fit: 1.93380585  Dif:  0.00000009 
#>  Iter:   10  Fit: 1.93380586  Dif:  0.00000001 
#>  Iter:   11  Fit: 1.93380586  Dif:  0.00000000 
#> The RGCCA algorithm converged to a stationary point after 10 iterations 

analyze(out)
#>       vs12       vs13       vs23  AVE_inner  AVE_outer        cc1      var12 
#>  0.4875286 -0.6270914 -0.7574030  0.4834515  0.4793766  0.9669029  0.0000000 
#>      var13      var23    weights 
#>  1.0000000  1.0000000  2.0000000